#At lp:maria

 2728 [email protected]  2009-09-11
      After-merge fix for MySQL 5.1.38 merge into MariaDB.
      
      Due to a bugfix for enum options in MariaDB, my_getopt parses enums into 
an ulong.
      However, some new code from MySQL was written to assume enums take an 
uint.
      
      Fix by using the correct type.
      
      (The new MySQL code in addition had an implicit assumption that my_bool 
and uint were
      compatible; remove this assumption).
      modified:
        mysys/my_getopt.c
        sql/sql_plugin.cc

=== modified file 'mysys/my_getopt.c'
--- a/mysys/my_getopt.c 2009-09-07 20:50:10 +0000
+++ b/mysys/my_getopt.c 2009-09-11 13:20:03 +0000
@@ -414,11 +414,17 @@ invalid value '%s'",
                    (optp->var_type & GET_TYPE_MASK) == GET_ENUM))
        {
          if (optend == disabled_my_option)
-           *((my_bool*) value)= (my_bool) 0;
+            if ((optp->var_type & GET_TYPE_MASK) == GET_BOOL)
+              *((my_bool*) value)= (my_bool) 0;
+            else
+              *((ulong*) value)= (ulong) 0;
          else
          {
            if (!optend) /* No argument -> enable option */
-             *((my_bool*) value)= (my_bool) 1;
+              if ((optp->var_type & GET_TYPE_MASK) == GET_BOOL)
+                *((my_bool*) value)= (my_bool) 1;
+              else
+                *((ulong*) value)= (ulong) 1;
             else
               argument= optend;
          }

=== modified file 'sql/sql_plugin.cc'
--- a/sql/sql_plugin.cc 2009-09-07 20:50:10 +0000
+++ b/sql/sql_plugin.cc 2009-09-11 13:20:03 +0000
@@ -2980,12 +2980,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 an ulong.
   */
   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;
 
@@ -3269,7 +3269,7 @@ static int test_plugin_options(MEM_ROOT 
      Set plugin loading policy from option value. First element in the option
      list is always the <plugin name> option value.
     */
-    plugin_load_policy= (enum_plugin_load_policy)*(uint*)opts[0].value;
+    plugin_load_policy= (enum_plugin_load_policy)*(ulong*)opts[0].value;
   }
 
   disable_plugin= (plugin_load_policy == PLUGIN_OFF);


_______________________________________________
Mailing list: https://launchpad.net/~maria-developers
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~maria-developers
More help   : https://help.launchpad.net/ListHelp

Reply via email to