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:
Aryan Arora
2025-02-21 09:31:21 +05:30
committed by Vicențiu-Marian Ciorbaru
parent b167730499
commit f3687ccaaf
8 changed files with 46 additions and 1 deletions

View File

@ -0,0 +1 @@
--slOw_QuEry_loG=OFF

View 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.

View 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.

View 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.

View File

@ -0,0 +1,7 @@
!include ../my.cnf
[mysqld.1]
wsrep-on=ON
wsrep-provider=@ENV.WSREP_PROVIDER
wsrep-cluster-address=gcomm://

View File

@ -0,0 +1 @@
--wsrep-slave-uk-checks=1

View 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.

View File

@ -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);