Skip to content

Commit 8468659

Browse files
committed
Bug #42144: plugin_load fails
Reverted the ulong->uint diff Re-applied the first diff. The original commit message follows: enum plugin system variables are ulong internally, not int. On systems where long is not the same as an int it causes problems. Fixed by correct typecasting. Removed the test from the experimental list.
1 parent 534e693 commit 8468659

4 files changed

Lines changed: 11 additions & 11 deletions

File tree

include/mysql/plugin.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ DECLARE_MYSQL_SYSVAR_SIMPLE(name, unsigned long long) = { \
318318
#name, comment, check, update, &varname, def, min, max, blk }
319319

320320
#define MYSQL_SYSVAR_ENUM(name, varname, opt, comment, check, update, def, typelib) \
321-
DECLARE_MYSQL_SYSVAR_TYPELIB(name, unsigned int) = { \
321+
DECLARE_MYSQL_SYSVAR_TYPELIB(name, unsigned long) = { \
322322
PLUGIN_VAR_ENUM | ((opt) & PLUGIN_VAR_MASK), \
323323
#name, comment, check, update, &varname, def, typelib }
324324

mysys/my_getopt.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -664,13 +664,13 @@ static int setval(const struct my_option *opts, void *value, char *argument,
664664
Accept an integer representation of the enumerated item.
665665
*/
666666
char *endptr;
667-
uint arg= (uint) strtoul(argument, &endptr, 10);
667+
ulong arg= strtoul(argument, &endptr, 10);
668668
if (*endptr || arg >= opts->typelib->count)
669669
return EXIT_ARGUMENT_INVALID;
670-
*(uint*)result_pos= arg;
670+
*((ulong*) result_pos)= arg;
671671
}
672672
else
673-
*(uint*)result_pos= type - 1;
673+
*((ulong*) result_pos)= type - 1;
674674
}
675675
break;
676676
case GET_SET:
@@ -1008,7 +1008,7 @@ static void init_one_value(const struct my_option *option, void *variable,
10081008
*((int*) variable)= (int) getopt_ll_limit_value((int) value, option, NULL);
10091009
break;
10101010
case GET_ENUM:
1011-
*((uint*) variable)= (uint) value;
1011+
*((ulong*) variable)= (ulong) value;
10121012
break;
10131013
case GET_UINT:
10141014
*((uint*) variable)= (uint) getopt_ull_limit_value((uint) value, option, NULL);
@@ -1248,7 +1248,7 @@ void my_print_variables(const struct my_option *options)
12481248
}
12491249
break;
12501250
case GET_ENUM:
1251-
printf("%s\n", get_type(optp->typelib, *(uint*) value));
1251+
printf("%s\n", get_type(optp->typelib, *(ulong*) value));
12521252
break;
12531253
case GET_STR:
12541254
case GET_STR_ALLOC: /* fall through */

sql/sql_plugin.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3030,12 +3030,12 @@ static int construct_options(MEM_ROOT *mem_root, struct st_plugin_int *tmp,
30303030
Allocate temporary space for the value of the tristate.
30313031
This option will have a limited lifetime and is not used beyond
30323032
server initialization.
3033-
GET_ENUM value is unsigned integer.
3033+
GET_ENUM value is a unsigned long integer.
30343034
*/
30353035
options[0].value= options[1].value= (uchar **)alloc_root(mem_root,
3036-
sizeof(uint));
3037-
*((uint*) options[0].value)= *((uint*) options[1].value)=
3038-
(uint) options[0].def_value;
3036+
sizeof(ulong));
3037+
*((ulong*) options[0].value)= *((ulong*) options[1].value)=
3038+
(ulong) options[0].def_value;
30393039

30403040
options+= 2;
30413041

storage/example/ha_example.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,7 @@ int ha_example::create(const char *name, TABLE *table_arg,
848848
struct st_mysql_storage_engine example_storage_engine=
849849
{ MYSQL_HANDLERTON_INTERFACE_VERSION };
850850

851-
static uint srv_enum_var= 0;
851+
static ulong srv_enum_var= 0;
852852
static ulong srv_ulong_var= 0;
853853

854854
const char *enum_var_names[]=

0 commit comments

Comments
 (0)