Commit a3138648 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-6056 [PATCH] mysqldump writes usage to stdout even when not explicitly requested

parent 5401d447
...@@ -598,12 +598,12 @@ static void print_version(void) ...@@ -598,12 +598,12 @@ static void print_version(void)
} /* print_version */ } /* print_version */
static void short_usage_sub(void) static void short_usage_sub(FILE *f)
{ {
printf("Usage: %s [OPTIONS] database [tables]\n", my_progname_short); fprintf(f, "Usage: %s [OPTIONS] database [tables]\n", my_progname_short);
printf("OR %s [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]\n", fprintf(f, "OR %s [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]\n",
my_progname_short); my_progname_short);
printf("OR %s [OPTIONS] --all-databases [OPTIONS]\n", my_progname_short); fprintf(f, "OR %s [OPTIONS] --all-databases [OPTIONS]\n", my_progname_short);
} }
...@@ -612,18 +612,18 @@ static void usage(void) ...@@ -612,18 +612,18 @@ static void usage(void)
print_version(); print_version();
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000")); puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
puts("Dumping structure and contents of MySQL databases and tables."); puts("Dumping structure and contents of MySQL databases and tables.");
short_usage_sub(); short_usage_sub(stdout);
print_defaults("my",load_default_groups); print_defaults("my",load_default_groups);
puts(""); puts("");
my_print_help(my_long_options); my_print_help(my_long_options);
my_print_variables(my_long_options); my_print_variables(my_long_options);
} /* usage */ } /* usage */
static void short_usage(void) static void short_usage(FILE *f)
{ {
short_usage_sub(); short_usage_sub(f);
printf("For more options, use %s --help\n", my_progname_short); fprintf(f, "For more options, use %s --help\n", my_progname_short);
} }
...@@ -996,7 +996,7 @@ static int get_options(int *argc, char ***argv) ...@@ -996,7 +996,7 @@ static int get_options(int *argc, char ***argv)
exit(1); exit(1);
if ((*argc < 1 && !opt_alldbs) || (*argc > 0 && opt_alldbs)) if ((*argc < 1 && !opt_alldbs) || (*argc > 0 && opt_alldbs))
{ {
short_usage(); short_usage(stderr);
return EX_USAGE; return EX_USAGE;
} }
if (tty_password) if (tty_password)
......
...@@ -5281,3 +5281,7 @@ drop table t1, t2; ...@@ -5281,3 +5281,7 @@ drop table t1, t2;
# #
# End of 5.1 tests # End of 5.1 tests
# #
Usage: mysqldump [OPTIONS] database [tables]
OR mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]
OR mysqldump [OPTIONS] --all-databases [OPTIONS]
For more options, use mysqldump --help
...@@ -2462,3 +2462,10 @@ drop table t1, t2; ...@@ -2462,3 +2462,10 @@ drop table t1, t2;
--error 2 --error 2
--exec $MYSQL_DUMP -hunknownhost --dump-slave nulldb --exec $MYSQL_DUMP -hunknownhost --dump-slave nulldb
#
# MDEV-6056 [PATCH] mysqldump writes usage to stdout even when not explicitly requested
#
--error 1
--exec $MYSQL_DUMP --user=foo 2>&1 > $MYSQLTEST_VARDIR/tmp/bug6056.out
--exec $MYSQL_DUMP --help > $MYSQLTEST_VARDIR/tmp/bug6056.out
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