Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-6056

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

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • 10.0.10
    • 10.0.11
    • None

    Description

      Upstream bug http://bugs.mysql.com/bug.php?id=51975 was errantly classified as a duplicate of non-bug http://bugs.mysql.com/bug.php?id=44848

      mysqldump should never write usage to stdout unless --help was passed as an argument.

      This change seems to correct the behavior:

       
      --- mysql-5.6.16/client/mysqldump.c	2014-01-14 15:38:00.000000000 +0000
      +++ mysql-5.6.16_modified/client/mysqldump.c	2014-02-14 02:56:28.000000000 +0000
      @@ -621,31 +621,31 @@
       } /* print_version */
       
       
      -static void short_usage_sub(void)
      +static void short_usage_sub(FILE *stream)
       {
      -  printf("Usage: %s [OPTIONS] database [tables]\n", my_progname);
      -  printf("OR     %s [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]\n",
      +  fprintf(stream, "Usage: %s [OPTIONS] database [tables]\n", my_progname);
      +  fprintf(stream, "OR     %s [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]\n",
                my_progname);
      -  printf("OR     %s [OPTIONS] --all-databases [OPTIONS]\n", my_progname);
      +  fprintf(stream, "OR     %s [OPTIONS] --all-databases [OPTIONS]\n", my_progname);
       }
       
       
      -static void usage(void)
      +static void usage(FILE *stream)
       {
         print_version();
         puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"));
         puts("Dumping structure and contents of MySQL databases and tables.");
      -  short_usage_sub();
      +  short_usage_sub(stream);
         print_defaults("my",load_default_groups);
         my_print_help(my_long_options);
         my_print_variables(my_long_options);
       } /* usage */
       
       
      -static void short_usage(void)
      +static void short_usage(FILE *stream)
       {
      -  short_usage_sub();
      -  printf("For more options, use %s --help\n", my_progname);
      +  short_usage_sub(stream);
      +  fprintf(stream, "For more options, use %s --help\n", my_progname);
       }
       
       
      @@ -824,7 +824,7 @@
           break;
         case 'I':
         case '?':
      -    usage();
      +    usage(stdout);
           exit(0);
         case (int) OPT_MASTER_DATA:
           if (!argument) /* work like in old versions */
      @@ -1020,7 +1020,7 @@
           exit(1);
         if ((*argc < 1 && !opt_alldbs) || (*argc > 0 && opt_alldbs))
         {
      -    short_usage();
      +    short_usage(stderr);
           return EX_USAGE;
         }
         if (tty_password)

      Attachments

        Activity

          People

            serg Sergei Golubchik
            mg MG
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.