From: Marc Alff Date: August 11 2010 5:00pm Subject: bzr commit into mysql-trunk-bugfixing branch (marc.alff:3197) Bug#55873 List-Archive: http://lists.mysql.com/commits/115515 X-Bug: 55873 Message-Id: <201008111701.o7BFpnk4006134@rcsinet15.oracle.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6850898515286018173==" --===============6850898515286018173== MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline #At file:///Users/malff/BZR_TREE/mysql-trunk-bugfixing-55873/ based on revid:jonathan.perkin@stripped 3197 Marc Alff 2010-08-11 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. 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. added: mysql-test/suite/perfschema/r/bad_option_3.result mysql-test/suite/perfschema/r/bad_option_4.result mysql-test/suite/perfschema/r/short_option.result mysql-test/suite/perfschema/t/bad_option_3.test mysql-test/suite/perfschema/t/bad_option_4.test mysql-test/suite/perfschema/t/short_option-master.opt mysql-test/suite/perfschema/t/short_option.test modified: mysys/my_getopt.c === added file 'mysql-test/suite/perfschema/r/bad_option_3.result' --- a/mysql-test/suite/perfschema/r/bad_option_3.result 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/perfschema/r/bad_option_3.result 2010-08-11 17:00:26 +0000 @@ -0,0 +1,2 @@ +Found: unknown option '-x' +Found: Aborting === added file 'mysql-test/suite/perfschema/r/bad_option_4.result' --- a/mysql-test/suite/perfschema/r/bad_option_4.result 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/perfschema/r/bad_option_4.result 2010-08-11 17:00:26 +0000 @@ -0,0 +1,4 @@ +Found: bad_option_h_param +Found: bad_option_h_param +Found: bad_option_h_param +Found: Aborting === added file 'mysql-test/suite/perfschema/r/short_option.result' --- a/mysql-test/suite/perfschema/r/short_option.result 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/perfschema/r/short_option.result 2010-08-11 17:00:26 +0000 @@ -0,0 +1,6 @@ +select 'Ok, the server started' as result; +result +Ok, the server started +select @@SQL_MODE; +@@SQL_MODE +REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI === added file 'mysql-test/suite/perfschema/t/bad_option_3.test' --- a/mysql-test/suite/perfschema/t/bad_option_3.test 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/perfschema/t/bad_option_3.test 2010-08-11 17:00:26 +0000 @@ -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= ; + # 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 + === added file 'mysql-test/suite/perfschema/t/bad_option_4.test' --- a/mysql-test/suite/perfschema/t/bad_option_4.test 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/perfschema/t/bad_option_4.test 2010-08-11 17:00:26 +0000 @@ -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= ; + # those must be in the file for the test to pass + my @patterns= + ("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 + === added file 'mysql-test/suite/perfschema/t/short_option-master.opt' --- a/mysql-test/suite/perfschema/t/short_option-master.opt 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/perfschema/t/short_option-master.opt 2010-08-11 17:00:26 +0000 @@ -0,0 +1 @@ +-a === added file 'mysql-test/suite/perfschema/t/short_option.test' --- a/mysql-test/suite/perfschema/t/short_option.test 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/perfschema/t/short_option.test 2010-08-11 17:00:26 +0000 @@ -0,0 +1,23 @@ +# 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; + +# Should contain ANSI, since we started the server with -a (stands for --ansi) +select @@SQL_MODE; + === modified file 'mysys/my_getopt.c' --- a/mysys/my_getopt.c 2010-07-16 21:00:50 +0000 +++ b/mysys/my_getopt.c 2010-08-11 17:00:26 +0000 @@ -464,6 +464,17 @@ int handle_options(int *argc, char ***ar } if (!opt_found) { + if (my_getopt_skip_unknown) + { + /* + Preserve this unknown short option. + If there are any parameters associated with this short option, + as in "-X p1 p2 p3", parameters like p1 p2 p3 will be copied + in the result by the outer loop. + */ + (*argv)[argvpos++]= *pos; + break; + } if (my_getopt_print_errors) my_getopt_error_reporter(ERROR_LEVEL, "%s: unknown option '-%c'", @@ -471,15 +482,21 @@ int handle_options(int *argc, char ***ar return EXIT_UNKNOWN_OPTION; } } - (*argc)--; /* option handled (short), decrease argument count */ - continue; + if (opt_found) + { + (*argc)--; /* option handled (short), decrease argument count */ + continue; + } } if ((error= setval(optp, value, argument, set_maximum_value))) return error; if (get_one_option && get_one_option(optp->id, optp, argument)) return EXIT_UNSPECIFIED_ERROR; - (*argc)--; /* option handled (short or long), decrease argument count */ + if (opt_found) + { + (*argc)--; /* option handled (short or long), decrease argument count */ + } } else /* non-option found */ (*argv)[argvpos++]= cur_arg; --===============6850898515286018173== MIME-Version: 1.0 Content-Type: text/bzr-bundle; charset="us-ascii"; name="bzr/marc.alff@stripped" Content-Transfer-Encoding: 7bit Content-Disposition: inline # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: marc.alff@stripped # target_branch: file:///Users/malff/BZR_TREE/mysql-trunk-bugfixing-\ # 55873/ # testament_sha1: ec4e4b97191b725fb8528a713a9e93f8b4b77b40 # timestamp: 2010-08-11 11:00:37 -0600 # base_revision_id: jonathan.perkin@stripped\ # 0g0ee595dxxqbkcz # # Begin bundle IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWdxsRIUACCPfgFx0Xf///3/n /+6////7YA+vl9mzCVDWEUAoA2ANKqpEJQJKSUACRRVQySaTamg1Aep5R6myNQeU0GhoGgAAAaek 0Gg40NA0aZGmjTIDEwQAA0BoDTIDAmQcaGgaNMjTRpkBiYIAAaA0BpkBgTIONDQNGmRpo0yAxMEA ANAaA0yAwJkCKQmgmgNI0yNCYhoEyJmiB6I9NJpgmRgg0EkQIAJkI0E1P0mpieQnqjaPKaam1NDQ 0ZDIGJowEkOD9f7JUSY0DZcHUneJbAltkYil/BXE7Jp556mpSRvtd2+wpQ13GQwnGF5iB6zgXxXC Z2klj/snK13pvpB+2v+sEDrpWpt3r7V0B6EEFRfmLiXkTPk8RzgWBTjYkDSKUGNxPqB2kWNigxU8 684K0iiCIbBMLTylWbWNaFIaRIhNNZT18fDnFBLBR9GdjtPy4mRwKEDoF8p0h0FCoYlG/qMIEznK Lpmsz0RMPPV7T/FpCh+hwPkA2+VkMwWFPOn/AMJ5wiwTXOn6ezEaBSrrSRDaQqRTYpI6wzF1bkqM C8wQsGKbIEYHca/gZRBpHRchxN79TId7ANH60LkJtrRh6G5zv6IeJraOluZobn73Jm+Jkehto3NG F7yza+PPUhtb2H5KL8Pxlld6FMzIL4dViH4k1JIhsYO4gosS6ZLwJPQqL1GNS+I7U6gpWNAZQcKH EVcA2qxSU3KQAkbgaNoEshr+tYisXoVV57B0abm5udORxD8OssNL89gGG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