Hi Alexey,
the patch is fine. Though I have a few minor suggestions:
- please try to keep lines under 80 characters (including comments);
- I guess s/DO_CHECK=1/DO_CHECK= 1/
- I have a strong feeling that lines like $MYSQL_CHECK --analyze --optimize were
actually intended to be $MYSQL_CHECK --analyze $MYSQL_CHECK --optimize
not $MYSQL_CHECK --optimize.
Regards,
Sergey
On Mon, Sep 27, 2010 at 06:48:02AM +0000, Alexey Botchkov wrote:
> #At file:///home/hf/work/35269/ based on
> revid:mats.kindahl@stripped
>
> 3203 Alexey Botchkov 2010-09-27
> Bug#35269 mysqlcheck behaves different depending on order of parameters
> Issue an error if user specifies multiple commands to run.
> Also there was an unnoticed bug that DO_CHECK was actually 0 which
> lead
> to wrong actions in some cases.
> The mysqlcheck.test contained commands with the suspicious meaning
> for the above reason. Extra commands removed from there.
>
> per-file commands:
> client/mysqlcheck.c
> Bug#35269 mysqlcheck behaves different depending on order of parameters
> Drop with an error if multiple commands.
> mysql-test/r/mysqlcheck.result
> Bug#35269 mysqlcheck behaves different depending on order of parameters
> result completed.
> mysql-test/t/mysqlcheck.test
> Bug#35269 mysqlcheck behaves different depending on order of parameters
> testcase added.
> not-working commands removed from some mysqlcheck calls.
>
> modified:
> client/mysqlcheck.c
> mysql-test/r/mysqlcheck.result
> mysql-test/t/mysqlcheck.test
> === modified file 'client/mysqlcheck.c'
> --- a/client/mysqlcheck.c 2010-07-15 13:47:50 +0000
> +++ b/client/mysqlcheck.c 2010-09-27 06:37:07 +0000
> @@ -48,7 +48,7 @@ static char *shared_memory_base_name=0;
> #endif
> static uint opt_protocol=0;
>
> -enum operations { DO_CHECK, DO_REPAIR, DO_ANALYZE, DO_OPTIMIZE, DO_UPGRADE };
> +enum operations { DO_CHECK=1, DO_REPAIR, DO_ANALYZE, DO_OPTIMIZE, DO_UPGRADE };
>
> static struct my_option my_long_options[] =
> {
> @@ -244,6 +244,8 @@ static my_bool
> get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
> char *argument)
> {
> + int orig_what_to_do= what_to_do;
> +
> switch(optid) {
> case 'a':
> what_to_do = DO_ANALYZE;
> @@ -318,6 +320,11 @@ get_one_option(int optid, const struct m
> opt->name);
> break;
> }
> + if (orig_what_to_do && (what_to_do != orig_what_to_do))
> + {
> + fprintf(stderr, "Error: mysqlcheck doesn't support multiple commands in
> line.\n");
> + return 1;
> + }
> return 0;
> }
>
>
> === modified file 'mysql-test/r/mysqlcheck.result'
> --- a/mysql-test/r/mysqlcheck.result 2010-01-15 11:42:15 +0000
> +++ b/mysql-test/r/mysqlcheck.result 2010-09-27 06:37:07 +0000
> @@ -198,3 +198,6 @@ Tables_in_test (t1-1)
> t1-1
> drop table `t1-1`;
> End of 5.1 tests
> +#
> +# Bug #35269: mysqlcheck behaves different depending on order of parameters
> +#
>
> === modified file 'mysql-test/t/mysqlcheck.test'
> --- a/mysql-test/t/mysqlcheck.test 2009-10-21 12:59:47 +0000
> +++ b/mysql-test/t/mysqlcheck.test 2010-09-27 06:37:07 +0000
> @@ -23,10 +23,10 @@ drop database if exists client_test_db;
> # Bug #13783 mysqlcheck tries to optimize and analyze information_schema
> #
> --replace_result 'Table is already up to date' OK
> ---exec $MYSQL_CHECK --all-databases --analyze --optimize
> +--exec $MYSQL_CHECK --all-databases --optimize
> --replace_result 'Table is already up to date' OK
> ---exec $MYSQL_CHECK --analyze --optimize --databases test information_schema mysql
> ---exec $MYSQL_CHECK --analyze --optimize information_schema schemata
> +--exec $MYSQL_CHECK --optimize --databases test information_schema mysql
> +--exec $MYSQL_CHECK --optimize information_schema schemata
>
> #
> # Bug #16502: mysqlcheck tries to check views
> @@ -34,9 +34,9 @@ drop database if exists client_test_db;
> create table t1 (a int);
> create view v1 as select * from t1;
> --replace_result 'Table is already up to date' OK
> ---exec $MYSQL_CHECK --analyze --optimize --databases test
> +--exec $MYSQL_CHECK --optimize --databases test
> --replace_result 'Table is already up to date' OK
> ---exec $MYSQL_CHECK --all-in-1 --analyze --optimize --databases test
> +--exec $MYSQL_CHECK --all-in-1 --optimize --databases test
> drop view v1;
> drop table t1;
>
> @@ -113,7 +113,7 @@ show tables;
> let $MYSQLD_DATADIR= `select @@datadir`;
> --copy_file $MYSQLD_DATADIR/test/v1.frm $MYSQLD_DATADIR/test/v-1.frm
> show tables;
> ---exec $MYSQL_CHECK --check-upgrade --fix-table-names --databases test
> +--exec $MYSQL_CHECK --fix-table-names --databases test
> show tables;
> drop view v1, `v-1`;
> drop table t1;
> @@ -212,3 +212,12 @@ show tables like 't1-1';
> drop table `t1-1`;
>
> --echo End of 5.1 tests
> +
> +--echo #
> +--echo # Bug #35269: mysqlcheck behaves different depending on order of parameters
> +--echo #
> +
> +--error 13
> +--exec $MYSQL_CHECK -a --fix-table-names test "#mysql50#t1-1"
> +--error 1
> +--exec $MYSQL_CHECK -aoc test "#mysql50#t1-1"
>
>
> --
> MySQL Code Commits Mailing List
> For list archives: http://lists.mysql.com/commits
> To unsubscribe: http://lists.mysql.com/commits?unsub=1
--
Sergey Vojtovich <svoj@stripped>
MySQL AB, Software Engineer
Izhevsk, Russia, www.mysql.com