← Back to team overview

maria-developers team mailing list archive

Bug in ENUM options handling?

 

While working on MariaDB on HP-UX we noticed an inconsistency involving
the type of enum arguments.

In init_variables and init_one_value (mysys/my_getopt.c), ENUM options
are treated as unsigned longs but the enum arguments are actually
declared as uint instead of ulong.  While this doesn't matter in 32 bit
mode when int's and longs's are the same size, it can cause problems in
64 bit mode when long's are 64 bits and int's 32 bits.

We found 4 variables that we think should be ulong instead of uint:

	plugin_maturity
	plugin_maturity_map
	thread_handling
	delay_key_write_options

We also changed the value field in the sys_var_enum class (sql/set_var.h)
from a uint pointer to a ulong pointer and changed the sys_var_enum and
sys_var_enum_const constructors to use a ulong pointer argument for value_arg
to make everything consistent.

I suppose init_variables and init_one_value could be changed to treat
ENUM's as uint instead of ulong but the use of ulong seemed to be
intentional so we didn't try making that change as an alternative fix.

Is this a change that should be made in the official MariaDB sources?

Steve Ellcey
sje@xxxxxxxxxx


Follow ups