typecheck_equals aborts the process on custom data types (unimplemented!)
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 76/100
Línea de trabajo
Empieza en la rama Custom de CassDataTypeInner::typecheck_equals en scylla-rust-wrapper/src/cql_types/data_type.rs (alrededor de las líneas 305-307), luego sigue la recursión a través de CassCqlValue::is_type_compatible en scylla-rust-wrapper/src/cql_types/value.rs para ver qué llamadores exponen el resultado como CASS_ERROR_LIB_INVALID_VALUE_TYPE. Reproduce con el test unitario esbozado en el issue (list<custom> metido en un tuple<list<int>>) y ejecútalo para confirmar que aborta antes de cambiar nada. Hecho significa que esa ruta de test devuelve un error en lugar de entrar en pánico, con las pruebas existentes de cql_types todavía pasando.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
What goes wrong
CassDataTypeInner::typecheck_equals ends with:
so any typecheck where the value-side type is (or contains) a Custom type panics. It runs inside extern "C" setters, so the process aborts.
A Custom data type is reachable through the public API: cass_data_type_new(CASS_VALUE_TYPE_CUSTOM) returns one, and cass_data_type_add_sub_type accepts it as a subtype:
Building a collection/tuple/UDT from such a type and then setting it into a typed tuple, UDT or collection (or binding it) goes through CassCqlValue::is_type_compatible -> typecheck_equals, which recurses into the subtypes and hits the Custom arm:
The expected outcome is CASS_ERROR_LIB_INVALID_VALUE_TYPE (or rejecting CUSTOM up front), not an abort.
Related: #158 (plan to drop custom types entirely). Until that lands, the API still hands out Custom types that later crash the process.
Reproduction
Temporary unit test in scylla-rust-wrapper/src/cql_types/data_type.rs tests:
// list<custom>
let custom = cass_data_type_new(CassValueType::CASS_VALUE_TYPE_CUSTOM);
let list_custom = cass_data_type_new(CassValueType::CASS_VALUE_TYPE_LIST);
cass_data_type_add_sub_type(list_custom.borrow(), custom.borrow().into_c_const());
// tuple<list<int>>
let int_t = cass_data_type_new(CassValueType::CASS_VALUE_TYPE_INT);
let list_int = cass_data_type_new(CassValueType::CASS_VALUE_TYPE_LIST);
cass_data_type_add_sub_type(list_int.borrow(), int_t.borrow().into_c_const());
let tup_t = cass_data_type_new(CassValueType::CASS_VALUE_TYPE_TUPLE);
cass_data_type_add_sub_type(tup_t.borrow(), list_int.borrow().into_c_const());
let coll = cass_collection_new_from_data_type(list_custom.borrow().into_c_const(), 0);
let mut tup = cass_tuple_new_from_data_type(tup_t.borrow().into_c_const());
cass_tuple_set_collection(tup.borrow_mut(), 0, coll.borrow().into_c_const());
panicked at src/cql_types/data_type.rs:306:17:
not implemented: cpp-rs-driver does not support custom types!
panicked at .../core/src/panicking.rs:225:5:
panic in a function that cannot unwind
thread caused non-unwinding panic. aborting.
Fix direction
Make the Custom arm of typecheck_equals return a result instead of panicking: either false (so the setter returns CASS_ERROR_LIB_INVALID_VALUE_TYPE), or, closer to cpp-driver, compare the custom class names when other is also Custom. Alternatively, since custom types are not supported (#158), have cass_data_type_new(CASS_VALUE_TYPE_CUSTOM) return NULL so a Custom type can never reach the typecheck.
- Lenguaje dominante
- C++
- Estrellas
- 27
- Forks
- 18
- Merge medio
- 1 d 7 h
- PR fusionados (30 d)
- 5
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de scylladb/cpp-rs-driver
-
area/Driver_-_cpp-rs-driver bug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
scylladb/cpp-rs-driver#546 ·
-
area/Driver_-_cpp-rs-driver bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
scylladb/cpp-rs-driver#544 ·
-
area/Driver_-_cpp-rs-driver bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
scylladb/cpp-rs-driver#543 ·
-
area/Driver_-_cpp-rs-driver bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
scylladb/cpp-rs-driver#542 ·
-
area/Driver_-_cpp-rs-driver bug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
scylladb/cpp-rs-driver#541 ·
Todos los issues de scylladb/cpp-rs-driver
Issues similares
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
raspberrypi/rpi-imager#1804 ·
-
difficulty: easy docs good first issue help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Ryan-Millard/Img2Num#842 ·
Los mantenedores suelen responder en 12 días
-
Unit converter reads out of bounds when the saved UnitConverterPreferences setting is malformedAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
microsoft/calculator#2532 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
-
bug difficulty:easy prio:normal
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
NatronGitHub/openfx-misc#411 ·
Los mantenedores suelen responder en 1 día