mirror of
https://github.com/MariaDB/server.git
synced 2025-08-17 21:39:33 +00:00
MDEV-27126 my_getopt compares option names case sensitively
my_getopt compares option names case-sensitively, causing "Unknown option" errors when users type mixed-case options like wsrep_slave_UK_checks in lowercase wsrep_slave_fk_checks. Made the comparison in the getopt_compare_strings() case-insensitive.
This commit is contained in:

committed by
Vicențiu-Marian Ciorbaru

parent
b167730499
commit
f3687ccaaf
1
mysql-test/main/my_getopt_case_insensitive.opt
Normal file
1
mysql-test/main/my_getopt_case_insensitive.opt
Normal file
@ -0,0 +1 @@
|
||||
--slOw_QuEry_loG=OFF
|
8
mysql-test/main/my_getopt_case_insensitive.result
Normal file
8
mysql-test/main/my_getopt_case_insensitive.result
Normal file
@ -0,0 +1,8 @@
|
||||
#
|
||||
# MDEV-27126: my_getopt compares option names case sensitively
|
||||
#
|
||||
# Check if the variable is set correctly from options
|
||||
SELECT @@GLOBAL.slow_query_log;
|
||||
@@GLOBAL.slow_query_log
|
||||
0
|
||||
# End of test.
|
8
mysql-test/main/my_getopt_case_insensitive.test
Normal file
8
mysql-test/main/my_getopt_case_insensitive.test
Normal file
@ -0,0 +1,8 @@
|
||||
--echo #
|
||||
--echo # MDEV-27126: my_getopt compares option names case sensitively
|
||||
--echo #
|
||||
|
||||
--echo # Check if the variable is set correctly from options
|
||||
SELECT @@GLOBAL.slow_query_log;
|
||||
|
||||
--echo # End of test.
|
8
mysql-test/suite/wsrep/r/wsrep_mixed_case_cmd_arg.result
Normal file
8
mysql-test/suite/wsrep/r/wsrep_mixed_case_cmd_arg.result
Normal file
@ -0,0 +1,8 @@
|
||||
#
|
||||
# MDEV-27126: my_getopt compares option names case sensitively
|
||||
#
|
||||
# Check if the variable is set correctly from options
|
||||
SELECT @@GLOBAL.wsrep_slave_uk_checks;
|
||||
@@GLOBAL.wsrep_slave_uk_checks
|
||||
1
|
||||
# End of test.
|
7
mysql-test/suite/wsrep/t/wsrep_mixed_case_cmd_arg.cnf
Normal file
7
mysql-test/suite/wsrep/t/wsrep_mixed_case_cmd_arg.cnf
Normal file
@ -0,0 +1,7 @@
|
||||
!include ../my.cnf
|
||||
|
||||
[mysqld.1]
|
||||
wsrep-on=ON
|
||||
wsrep-provider=@ENV.WSREP_PROVIDER
|
||||
wsrep-cluster-address=gcomm://
|
||||
|
1
mysql-test/suite/wsrep/t/wsrep_mixed_case_cmd_arg.opt
Normal file
1
mysql-test/suite/wsrep/t/wsrep_mixed_case_cmd_arg.opt
Normal file
@ -0,0 +1 @@
|
||||
--wsrep-slave-uk-checks=1
|
11
mysql-test/suite/wsrep/t/wsrep_mixed_case_cmd_arg.test
Normal file
11
mysql-test/suite/wsrep/t/wsrep_mixed_case_cmd_arg.test
Normal file
@ -0,0 +1,11 @@
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_wsrep_provider.inc
|
||||
--source include/have_binlog_format_row.inc
|
||||
--echo #
|
||||
--echo # MDEV-27126: my_getopt compares option names case sensitively
|
||||
--echo #
|
||||
|
||||
--echo # Check if the variable is set correctly from options
|
||||
SELECT @@GLOBAL.wsrep_slave_uk_checks;
|
||||
|
||||
--echo # End of test.
|
@ -18,6 +18,7 @@
|
||||
#include <mysys_priv.h>
|
||||
#include <my_default.h>
|
||||
#include <m_string.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <mysys_err.h>
|
||||
#include <my_getopt.h>
|
||||
@ -962,7 +963,7 @@ my_bool getopt_compare_strings(register const char *s, register const char *t,
|
||||
|
||||
for (;s != end ; s++, t++)
|
||||
{
|
||||
if ((*s != '-' ? *s : '_') != (*t != '-' ? *t : '_'))
|
||||
if ((*s != '-' ? tolower(*s) : '_') != (*t != '-' ? tolower(*t) : '_'))
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
|
Reference in New Issue
Block a user