Commit fbd4378b authored by unknown's avatar unknown

Bug#10608 mysqladmin breaks on "database" variable in my.cnf

 - Add printout of "Warning" or "Note" for non error messages in default_reporter
 - Add test for the above in new mysqladmin.test


mysql-test/mysql-test-run.pl:
  Add support for mysqladmin to mysql-test-run.pl
mysys/my_getopt.c:
  Add printout of Warning: or Info: in 'default_reporter', this
  will make the user aware of the problem but can filter it
  as a warning or note.
mysql-test/r/mysqladmin.result:
  New BitKeeper file ``mysql-test/r/mysqladmin.result''
mysql-test/t/mysqladmin.test:
  New BitKeeper file ``mysql-test/t/mysqladmin.test''
parent fc449ac1
...@@ -1818,6 +1818,10 @@ sub environment_setup () { ...@@ -1818,6 +1818,10 @@ sub environment_setup () {
# ---------------------------------------------------- # ----------------------------------------------------
$ENV{'MYSQL_MY_PRINT_DEFAULTS'}= $exe_my_print_defaults; $ENV{'MYSQL_MY_PRINT_DEFAULTS'}= $exe_my_print_defaults;
# ----------------------------------------------------
# Setup env so childs can execute mysqladmin
# ----------------------------------------------------
$ENV{'MYSQLADMIN'}= $exe_mysqladmin;
# ---------------------------------------------------- # ----------------------------------------------------
# Setup env so childs can execute perror # Setup env so childs can execute perror
......
mysqld is alive
mysqladmin: unknown variable 'database=db1'
Warning: mysqladmin: unknown variable 'loose-database=db2'
mysqld is alive
#
# Test "mysqladmin ping"
#
--exec $MYSQLADMIN --no-defaults -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping 2>&1
#
# Bug#10608 mysqladmin breaks on "database" variable in my.cnf
#
# When mysqladmin finds database in .cnf file it shall fail
--write_file $MYSQLTEST_VARDIR/tmp/bug10608.cnf
[client]
database=db1
EOF
--replace_regex /\/.*mysqladmin/mysqladmin/
--error 7
--exec $MYSQLADMIN --defaults-file=$MYSQLTEST_VARDIR/tmp/bug10608.cnf -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping 2>&1
# When mysqladmin finds "loose-database" in .cnf file it shall print
# a warning and continue
--write_file $MYSQLTEST_VARDIR/tmp/bug10608.cnf
[client]
loose-database=db2
EOF
--replace_regex /Warning: .*mysqladmin/Warning: mysqladmin/
--exec $MYSQLADMIN --defaults-file=$MYSQLTEST_VARDIR/tmp/bug10608.cnf -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping 2>&1
...@@ -59,11 +59,15 @@ char *disabled_my_option= (char*) "0"; ...@@ -59,11 +59,15 @@ char *disabled_my_option= (char*) "0";
my_bool my_getopt_print_errors= 1; my_bool my_getopt_print_errors= 1;
static void default_reporter(enum loglevel level __attribute__((unused)), static void default_reporter(enum loglevel level,
const char *format, ...) const char *format, ...)
{ {
va_list args; va_list args;
va_start(args, format); va_start(args, format);
if (level == WARNING_LEVEL)
fprintf(stderr, "%s", "Warning: ");
else if (level == INFORMATION_LEVEL)
fprintf(stderr, "%s", "Info: ");
vfprintf(stderr, format, args); vfprintf(stderr, format, args);
va_end(args); va_end(args);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment