List:Commits« Previous MessageNext Message »
From:Georgi Kodinov Date:August 3 2010 4:01pm
Subject:bzr commit into mysql-5.1-bugteam branch (Georgi.Kodinov:3472) Bug#42144
View as plain text  
#At file:///Users/kgeorge/mysql/work/B42144-5.1-bugteam/ based on revid:dao-gang.qu@stripped

 3472 Georgi Kodinov	2010-08-03
      Bug #42144: plugin_load fails
      
      The enum system variables were handled inconsistently 
      as ints, unsigned int and unsigned long on various places.
      This caused problems on platforms on which 
      sizeof(int) != sizeof(long).
      Fixed by homogenizing the type of the enum variables
      to unsigned int, since it's size compatible with the C enum
      type. 
      Removed the test from the experimental list.

    modified:
      include/mysql/plugin.h
      mysql-test/collections/default.experimental
      mysys/my_getopt.c
      sql/sql_plugin.cc
      storage/example/ha_example.cc
=== modified file 'include/mysql/plugin.h'
--- a/include/mysql/plugin.h	2010-04-14 09:53:59 +0000
+++ b/include/mysql/plugin.h	2010-08-03 16:01:30 +0000
@@ -318,7 +318,7 @@ DECLARE_MYSQL_SYSVAR_SIMPLE(name, unsign
   #name, comment, check, update, &varname, def, min, max, blk }
 
 #define MYSQL_SYSVAR_ENUM(name, varname, opt, comment, check, update, def, typelib) \
-DECLARE_MYSQL_SYSVAR_TYPELIB(name, unsigned long) = { \
+DECLARE_MYSQL_SYSVAR_TYPELIB(name, unsigned int) = { \
   PLUGIN_VAR_ENUM | ((opt) & PLUGIN_VAR_MASK), \
   #name, comment, check, update, &varname, def, typelib }
 

=== 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-08-03 16:01:30 +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-08-03 16:01:30 +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;
+          uint arg= (uint) strtoul(argument, &endptr, 10);
+          if (*endptr || arg >= opts->typelib->count)
+            return EXIT_ARGUMENT_INVALID;
+          *(uint*)result_pos= arg;
+        }
+        else
+          *(uint*)result_pos= type - 1;
       }
       break;
     case GET_SET:

=== modified file 'sql/sql_plugin.cc'
--- a/sql/sql_plugin.cc	2010-06-10 20:16:43 +0000
+++ b/sql/sql_plugin.cc	2010-08-03 16:01:30 +0000
@@ -3030,10 +3030,10 @@ 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 unsigned integer.
   */
   options[0].value= options[1].value= (uchar **)alloc_root(mem_root,
-                                                          sizeof(int));
+                                                          sizeof(uint));
   *((uint*) options[0].value)= *((uint*) options[1].value)=
     (uint) options[0].def_value;
 

=== modified file 'storage/example/ha_example.cc'
--- a/storage/example/ha_example.cc	2010-07-20 18:07:36 +0000
+++ b/storage/example/ha_example.cc	2010-08-03 16:01:30 +0000
@@ -848,7 +848,7 @@ int ha_example::create(const char *name,
 struct st_mysql_storage_engine example_storage_engine=
 { MYSQL_HANDLERTON_INTERFACE_VERSION };
 
-static ulong srv_enum_var= 0;
+static uint srv_enum_var= 0;
 static ulong srv_ulong_var= 0;
 
 const char *enum_var_names[]=


Attachment: [text/bzr-bundle] bzr/georgi.kodinov@oracle.com-20100803160130-w5yov8uvd76dfqgp.bundle
Thread
bzr commit into mysql-5.1-bugteam branch (Georgi.Kodinov:3472) Bug#42144Georgi Kodinov3 Aug
  • Re: bzr commit into mysql-5.1-bugteam branch (Georgi.Kodinov:3472)Bug#42144Davi Arnaut3 Aug
    • Re: bzr commit into mysql-5.1-bugteam branch (Georgi.Kodinov:3472)Bug#42144Sergei Golubchik5 Aug
      • Re: bzr commit into mysql-5.1-bugteam branch (Georgi.Kodinov:3472)Bug#42144Davi Arnaut5 Aug