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

mysql_config returns non-zero when running without parameters

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 5.5.34
    • Fix Version/s: 5.5.36
    • Component/s: None
    • Labels:
      None
    • Environment:
      Linux

      Description

      When running mysql_config without any parameters, it returns 1 as exit code. It seems like improper behaviour, because any arguments are voluntary according to usage description. So it seems it should exit with 0 when running without any parameters.

      This is obviously not a serious bug, but can make problems for some tools that handle exit codes automatically.

      This can be a fix:

      diff -up mariadb-5.5.34/scripts/mysql_config.sh.exitcode mariadb-5.5.34/scripts/mysql_config.sh
      --- mariadb-5.5.34/scripts/mysql_config.sh.exitcode	2013-12-12 16:37:20.085758119 +0100
      +++ mariadb-5.5.34/scripts/mysql_config.sh	2013-12-12 16:38:06.749781337 +0100
      @@ -158,6 +158,7 @@ libs=`echo "$libs" | sed -e 's;  \+; ;g'
       libs_r=`echo "$libs_r" | sed -e 's;  \+; ;g' | sed -e 's;^ *;;' | sed -e 's; *\$;;'`
       embedded_libs=`echo "$embedded_libs" | sed -e 's;  \+; ;g' | sed -e 's;^ *;;' | sed -e 's; *\$;;'`
       
      +# 1st argument is exit code, 1 if omitted
       usage () {
               cat <<EOF
       Usage: $0 [OPTIONS]
      @@ -176,10 +177,10 @@ Options:
                       pkglibdir     [$pkglibdir]
                       plugindir     [$plugindir]
       EOF
      -        exit 1
      +        exit ${1:-1}
       }
       
      -if test $# -le 0; then usage; fi
      +if test $# -le 0; then usage 0; fi
       
       while test $# -gt 0; do
               case $1 in
      

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            serg Sergei Golubchik added a comment -

            I would rather change the description to say that options are required. Apparently, the use case is something like

            CFLAGS=`mysql_config --cflags`
            

            that is, calling mysql_config without options isn't useful for tools.

            Still, if you'd prefer that, I can change the exit code.

            Show
            serg Sergei Golubchik added a comment - I would rather change the description to say that options are required. Apparently, the use case is something like CFLAGS=`mysql_config --cflags` that is, calling mysql_config without options isn't useful for tools. Still, if you'd prefer that, I can change the exit code.
            Hide
            hhorak Honza Horak added a comment -

            Well, just given the fact there is quite nice output of mysql_config without args, it seems to me like it was mentioned to be run that way for any reason. So I'd simply vote for changing the exit code, but I don't have any stronger reasons.

            Show
            hhorak Honza Horak added a comment - Well, just given the fact there is quite nice output of mysql_config without args, it seems to me like it was mentioned to be run that way for any reason. So I'd simply vote for changing the exit code, but I don't have any stronger reasons.

              People

              • Assignee:
                serg Sergei Golubchik
                Reporter:
                hhorak Honza Horak
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: