mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Bug#55873 short startup options do not work in 5.5
Before this fix, the server did not recognize 'short' (as in -a) options but only 'long' (as in --ansi) options in the startup command line, due to earlier changes in 5.5 introduced for the performance schema. The root cause is that handle_options() did not honor the my_getopt_skip_unknown flag when parsing 'short' options. The fix changes handle_options(), so that my_getopt_skip_unknown is honored in all cases. Note that there are limitations to this, see the added doxygen documentation in handle_options(). The current usage of handle_options() by the server to parse early performance schema options fits within the limitations. This has been enforced by an assert for PARSE_EARLY options, for safety.
This commit is contained in:
49
mysql-test/suite/perfschema/t/bad_option_3.test
Normal file
49
mysql-test/suite/perfschema/t/bad_option_3.test
Normal file
@ -0,0 +1,49 @@
|
||||
# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; version 2 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
|
||||
|
||||
# Tests for PERFORMANCE_SCHEMA
|
||||
# Check error handling for invalid server start options
|
||||
|
||||
--source include/not_embedded.inc
|
||||
--source include/have_perfschema.inc
|
||||
|
||||
let $outfile= $MYSQLTEST_VARDIR/tmp/bad_option_3.txt;
|
||||
--error 0,1
|
||||
--remove_file $outfile
|
||||
--error 2
|
||||
--exec $MYSQLD_BOOTSTRAP_CMD --loose-console -a -x > $outfile 2>&1
|
||||
|
||||
perl;
|
||||
use strict;
|
||||
use warnings;
|
||||
my $fname= "$ENV{'MYSQLTEST_VARDIR'}/tmp/bad_option_3.txt";
|
||||
open(FILE, "<", $fname) or die;
|
||||
my @lines= <FILE>;
|
||||
# those must be in the file for the test to pass
|
||||
my @patterns=
|
||||
("unknown option '-x'",
|
||||
"Aborting");
|
||||
foreach my $one_line (@lines)
|
||||
{
|
||||
foreach my $one_pattern (@patterns)
|
||||
{
|
||||
# print pattern, not line, to get a stable output
|
||||
print "Found: $one_pattern\n" if ($one_line =~ /$one_pattern/);
|
||||
}
|
||||
}
|
||||
close FILE;
|
||||
EOF
|
||||
--remove_file $outfile
|
||||
|
49
mysql-test/suite/perfschema/t/bad_option_4.test
Normal file
49
mysql-test/suite/perfschema/t/bad_option_4.test
Normal file
@ -0,0 +1,49 @@
|
||||
# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; version 2 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
|
||||
|
||||
# Tests for PERFORMANCE_SCHEMA
|
||||
# Check error handling for invalid server start options
|
||||
|
||||
--source include/not_embedded.inc
|
||||
--source include/have_perfschema.inc
|
||||
|
||||
let $outfile= $MYSQLTEST_VARDIR/tmp/bad_option_4.txt;
|
||||
--error 0,1
|
||||
--remove_file $outfile
|
||||
--error 1
|
||||
--exec $MYSQLD_BOOTSTRAP_CMD --loose-console -a -h bad_option_h_param > $outfile 2>&1
|
||||
|
||||
perl;
|
||||
use strict;
|
||||
use warnings;
|
||||
my $fname= "$ENV{'MYSQLTEST_VARDIR'}/tmp/bad_option_4.txt";
|
||||
open(FILE, "<", $fname) or die;
|
||||
my @lines= <FILE>;
|
||||
# those must be in the file for the test to pass
|
||||
my @patterns=
|
||||
("Can't change dir to.*bad_option_h_param",
|
||||
"Aborting");
|
||||
foreach my $one_line (@lines)
|
||||
{
|
||||
foreach my $one_pattern (@patterns)
|
||||
{
|
||||
# print pattern, not line, to get a stable output
|
||||
print "Found: $one_pattern\n" if ($one_line =~ /$one_pattern/);
|
||||
}
|
||||
}
|
||||
close FILE;
|
||||
EOF
|
||||
--remove_file $outfile
|
||||
|
52
mysql-test/suite/perfschema/t/bad_option_5.test
Normal file
52
mysql-test/suite/perfschema/t/bad_option_5.test
Normal file
@ -0,0 +1,52 @@
|
||||
# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; version 2 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
|
||||
|
||||
# Tests for PERFORMANCE_SCHEMA
|
||||
# Check error handling for invalid server start options
|
||||
|
||||
--source include/not_embedded.inc
|
||||
--source include/have_perfschema.inc
|
||||
|
||||
let $outfile= $MYSQLTEST_VARDIR/tmp/bad_option_5.txt;
|
||||
--error 0,1
|
||||
--remove_file $outfile
|
||||
--error 2
|
||||
--exec $MYSQLD_BOOTSTRAP_CMD --loose-console -aXbroken > $outfile 2>&1
|
||||
|
||||
# -aXbroken should be parsed as -a -Xbroken, or --ansi -Xbroken,
|
||||
# therefore the -X option is what the server should complain about
|
||||
|
||||
perl;
|
||||
use strict;
|
||||
use warnings;
|
||||
my $fname= "$ENV{'MYSQLTEST_VARDIR'}/tmp/bad_option_5.txt";
|
||||
open(FILE, "<", $fname) or die;
|
||||
my @lines= <FILE>;
|
||||
# those must be in the file for the test to pass
|
||||
my @patterns=
|
||||
("unknown option '-X'",
|
||||
"Aborting");
|
||||
foreach my $one_line (@lines)
|
||||
{
|
||||
foreach my $one_pattern (@patterns)
|
||||
{
|
||||
# print pattern, not line, to get a stable output
|
||||
print "Found: $one_pattern\n" if ($one_line =~ /$one_pattern/);
|
||||
}
|
||||
}
|
||||
close FILE;
|
||||
EOF
|
||||
--remove_file $outfile
|
||||
|
1
mysql-test/suite/perfschema/t/short_option_1-master.opt
Normal file
1
mysql-test/suite/perfschema/t/short_option_1-master.opt
Normal file
@ -0,0 +1 @@
|
||||
-a -n -Cutf8 --collation=utf8_bin -l -T12 -W3
|
35
mysql-test/suite/perfschema/t/short_option_1.test
Normal file
35
mysql-test/suite/perfschema/t/short_option_1.test
Normal file
@ -0,0 +1,35 @@
|
||||
# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; version 2 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
|
||||
|
||||
# Tests for PERFORMANCE_SCHEMA
|
||||
# Check server start for short server start options
|
||||
|
||||
select 'Ok, the server started' as result;
|
||||
|
||||
# See the associated -master.opt file.
|
||||
|
||||
select @@SQL_MODE;
|
||||
show variables like 'sql_mode';
|
||||
|
||||
select @@character_set_server;
|
||||
show variables like 'character_set_system';
|
||||
|
||||
show variables like 'log';
|
||||
show variables like 'general_log';
|
||||
|
||||
show variables like 'new';
|
||||
|
||||
show variables like 'log_warnings';
|
||||
|
1
mysql-test/suite/perfschema/t/short_option_2-master.opt
Normal file
1
mysql-test/suite/perfschema/t/short_option_2-master.opt
Normal file
@ -0,0 +1 @@
|
||||
-aW5
|
29
mysql-test/suite/perfschema/t/short_option_2.test
Normal file
29
mysql-test/suite/perfschema/t/short_option_2.test
Normal file
@ -0,0 +1,29 @@
|
||||
# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; version 2 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
|
||||
|
||||
# Tests for PERFORMANCE_SCHEMA
|
||||
# Check server start for short server start options
|
||||
|
||||
select 'Ok, the server started' as result;
|
||||
|
||||
# See the associated -master.opt file.
|
||||
# -aW5 should be parsed as -a -W5, which are two separate short options
|
||||
# stuffed inside a single argv[i] argument.
|
||||
|
||||
# Should contain ANSI, since we started the server with -a (stands for --ansi)
|
||||
select @@SQL_MODE;
|
||||
|
||||
# Should be 5, since we started the server with -W5
|
||||
select @@log_warnings;
|
Reference in New Issue
Block a user