#At file:///Users/kgeorge/mysql/work/B42144-5.1-bugteam/ based on revid:li-bing.song@stripped
3470 Georgi Kodinov 2010-07-30
Bug #42144: plugin_load fails
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.
modified:
mysql-test/collections/default.experimental
mysys/my_getopt.c
sql/sql_plugin.cc
=== modified file 'mysql-test/collections/default.experimental'
--- a/mysql-test/collections/default.experimental 2010-06-03 08:31:26 +0000
+++ b/mysql-test/collections/default.experimental 2010-07-30 13:55:06 +0000
@@ -14,7 +14,6 @@ funcs_2.ndb_charset
main.ctype_gbk_binlog @solaris # Bug#46010: main.ctype_gbk_binlog fails sporadically : Table 't2' already exists
main.func_str @solaris # joro: Bug#40928
-main.plugin_load @solaris # Bug#42144
main.sp @solaris # joro : Bug#54138
main.outfile_loaddata @solaris # joro : Bug #46895
=== modified file 'mysys/my_getopt.c'
--- a/mysys/my_getopt.c 2010-07-02 18:30:47 +0000
+++ b/mysys/my_getopt.c 2010-07-30 13:55:06 +0000
@@ -656,17 +656,21 @@ static int setval(const struct my_option
return EXIT_OUT_OF_MEMORY;
break;
case GET_ENUM:
- if (((*(int*)result_pos)=
- find_type(argument, opts->typelib, 2) - 1) < 0)
{
- /*
- Accept an integer representation of the enumerated item.
- */
- char *endptr;
- unsigned int arg= (unsigned int) strtol(argument, &endptr, 10);
- if (*endptr || arg >= opts->typelib->count)
- return EXIT_ARGUMENT_INVALID;
- *(int*)result_pos= arg;
+ int type= find_type(argument, opts->typelib, 2);
+ if (type < 1)
+ {
+ /*
+ Accept an integer representation of the enumerated item.
+ */
+ char *endptr;
+ ulong arg= strtoul(argument, &endptr, 10);
+ if (*endptr || arg >= opts->typelib->count)
+ return EXIT_ARGUMENT_INVALID;
+ *((ulong*) result_pos)= arg;
+ }
+ else
+ *((ulong*) result_pos)= type - 1;
}
break;
case GET_SET:
@@ -1004,7 +1008,7 @@ static void init_one_value(const struct
*((int*) variable)= (int) getopt_ll_limit_value((int) value, option, NULL);
break;
case GET_ENUM:
- *((uint*) variable)= (uint) value;
+ *((ulong*) variable)= (ulong) value;
break;
case GET_UINT:
*((uint*) variable)= (uint) getopt_ull_limit_value((uint) value, option, NULL);
@@ -1244,7 +1248,7 @@ void my_print_variables(const struct my_
}
break;
case GET_ENUM:
- printf("%s\n", get_type(optp->typelib, *(uint*) value));
+ printf("%s\n", get_type(optp->typelib, *(ulong*) value));
break;
case GET_STR:
case GET_STR_ALLOC: /* fall through */
=== modified file 'sql/sql_plugin.cc'
--- a/sql/sql_plugin.cc 2010-06-10 20:16:43 +0000
+++ b/sql/sql_plugin.cc 2010-07-30 13:55:06 +0000
@@ -3030,12 +3030,12 @@ static int construct_options(MEM_ROOT *m
Allocate temporary space for the value of the tristate.
This option will have a limited lifetime and is not used beyond
server initialization.
- GET_ENUM value is an integer.
+ GET_ENUM value is a long integer.
*/
options[0].value= options[1].value= (uchar **)alloc_root(mem_root,
- sizeof(int));
- *((uint*) options[0].value)= *((uint*) options[1].value)=
- (uint) options[0].def_value;
+ sizeof(ulong));
+ *((ulong*) options[0].value)= *((ulong*) options[1].value)=
+ (ulong) options[0].def_value;
options+= 2;
Attachment: [text/bzr-bundle] bzr/georgi.kodinov@oracle.com-20100730135506-j0dtlj8fz4z185fr.bundle
| Thread |
|---|
| • bzr commit into mysql-5.1-bugteam branch (Georgi.Kodinov:3470) Bug#42144 | Georgi Kodinov | 30 Jul |