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

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

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

          mg MG created issue -
          mg MG made changes -
          Field Original Value New Value
          Attachment mdev6056.txt [ 28900 ]
          elenst Elena Stepanova made changes -
          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)
          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:

          {noformat}

          --- 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)
          elenst Elena Stepanova made changes -
          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:

          {noformat}

          --- 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)
          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:

          {noformat}

          --- 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)
          {noformat}
          elenst Elena Stepanova made changes -
          elenst Elena Stepanova made changes -
          Fix Version/s 10.0.11 [ 15200 ]
          Assignee Sergei Golubchik [ serg ]
          Summary mysqldump writes usage to stdout even when not explicitly requested [PATCH] mysqldump writes usage to stdout even when not explicitly requested
          serg Sergei Golubchik made changes -
          serg Sergei Golubchik made changes -
          serg Sergei Golubchik made changes -
          serg Sergei Golubchik made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          serg Sergei Golubchik made changes -
          Fix Version/s 10.0.12 [ 15201 ]
          Fix Version/s 10.0.11 [ 15200 ]
          serg Sergei Golubchik made changes -
          Status In Progress [ 3 ] Stalled [ 10000 ]
          serg Sergei Golubchik made changes -
          Fix Version/s 10.0.11 [ 15200 ]
          Fix Version/s 10.0.12 [ 15201 ]
          Resolution Fixed [ 1 ]
          Status Stalled [ 10000 ] Closed [ 6 ]
          serg Sergei Golubchik made changes -
          Workflow defaullt [ 38703 ] MariaDB v2 [ 42969 ]
          ratzpo Rasmus Johansson (Inactive) made changes -
          Workflow MariaDB v2 [ 42969 ] MariaDB v3 [ 62665 ]
          serg Sergei Golubchik made changes -
          Workflow MariaDB v3 [ 62665 ] MariaDB v4 [ 147767 ]

          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.