[MDEV-2344] LP:423035 - error in parsing enum value for plugin variable in mysqld command-line option Created: 2009-09-02  Updated: 2012-10-04  Resolved: 2012-10-04

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Kristian Nielsen Assignee: Kristian Nielsen
Resolution: Fixed Votes: 0
Labels: Launchpad

Attachments: XML File LPexportBug423035.xml    

 Description   

This should fail:

mysqld --plugin-load=EXAMPLE=ha_example.so --plugin-example-enum-var=noexist

But it does not in current MariaDB 5.1, due to an incorrect cast/unsigned comparison. Instead it sets the variable to some value (0 I think).

Fix:

=== modified file 'mysys/my_getopt.c'
— mysys/my_getopt.c 2009-05-20 15:34:34 +0000
+++ mysys/my_getopt.c 2009-09-02 08:13:14 +0000
@@ -603,6 +603,7 @@ static int setval(const struct my_option
my_bool set_maximum_value)
{
int err= 0;
+ int pos;

if (value && argument)
{
@@ -647,7 +648,9 @@ static int setval(const struct my_option
return EXIT_OUT_OF_MEMORY;
break;
case GET_ENUM:

  • if (((*(ulong *)result_pos)= find_type(argument, opts->typelib, 2) - 1) < 0)
    + pos= find_type(argument, opts->typelib, 2) - 1;
    + (*(ulong *)result_pos)= pos;
    + if (pos < 0)
    return EXIT_ARGUMENT_INVALID;
    break;
    case GET_SET:

Bug was introduced with this patch:

------------------------------------------------------------
revno: 2703
revision-id: <email address hidden>
parent: <email address hidden>
committer: <email address hidden>
branch nick: work-5.1-ourdelta
timestamp: Wed 2009-05-20 17:34:34 +0200
message:
Fix accessing ulong enum option as uint, failing on 64-bit big-endian.



 Comments   
Comment by Rasmus Johansson (Inactive) [ 2009-09-07 ]

Launchpad bug id: 423035

Generated at Thu Feb 08 06:41:12 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.