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

LP:700982 - Non-portable code in client plugin (fails on ARM)

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:

      Description

      The sql-common/client_plugin.c has this code:

      static struct st_mysql_client_plugin *
      add_plugin(MYSQL *mysql, struct st_mysql_client_plugin *plugin, void *dlhandle,
                 int argc, va_list args)

      { ... }

      int mysql_client_plugin_init()
      {
        ...
          add_plugin(&mysql, *builtin, 0, 0, 0);

      struct st_mysql_client_plugin *
      mysql_client_register_plugin(MYSQL *mysql,
                                   struct st_mysql_client_plugin *plugin)
      {
        ...
          plugin= add_plugin(mysql, plugin, 0, 0, 0);

      This passes 0 for the va_list argument. This is not correct C, there is no
      guarantee that va_list is a pointer (or other type compatible with integer).
      I got a report that GCC 4.5 fails on this on ARM.

      An easy solution is to just declare and pass a dummy va_list instead; as argc
      is zero it won't be used anyway.

      [There is no code example in the source tree that actually uses the va_list arg
      in the init function. The only client plugin I could find is, in
      plugin/auth/dialog.c, and doesn't use the va_list argument:

      static int init_dialog()
      {
        ...
      }

      mysql_declare_client_plugin(AUTHENTICATION)
        "dialog",
        ...
        init_dialog,

      This BTW seems to be putting an int () for init_dialog, where it should be
      int (char *, size_t, int, va_list). This also isn't correct C, and while
      perhaps unlikely to fail in practice, there is no reason not to use the
      correct type for the function.]

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            ratzpo Rasmus Johansson added a comment -

            Re: Non-portable code in client plugin (fails on ARM)
            Here is the full error message:

            /home/esmil/mysql-5.5.8/sql-common/client_plugin.c: In function ‘mysql_client_plugin_init’:
            /home/esmil/mysql-5.5.8/sql-common/client_plugin.c:252:5: error: incompatible type for argument 5 of ‘add_plugin’
            /home/esmil/mysql-5.5.8/sql-common/client_plugin.c:126:1: note: expected ‘va_list’ but argument is of type ‘int’
            /home/esmil/mysql-5.5.8/sql-common/client_plugin.c: In function ‘mysql_client_register_plugin’:
            /home/esmil/mysql-5.5.8/sql-common/client_plugin.c:310:5: error: incompatible type for argument 5 of ‘add_plugin’
            /home/esmil/mysql-5.5.8/sql-common/client_plugin.c:126:1: note: expected ‘va_list’ but argument is of type ‘int’
            make[2]: *** [libmysqld/CMakeFiles/sql_embedded.dir/__/sql-common/client_plugin.c.o] Error 1

            Show
            ratzpo Rasmus Johansson added a comment - Re: Non-portable code in client plugin (fails on ARM) Here is the full error message: /home/esmil/mysql-5.5.8/sql-common/client_plugin.c: In function ‘mysql_client_plugin_init’: /home/esmil/mysql-5.5.8/sql-common/client_plugin.c:252:5: error: incompatible type for argument 5 of ‘add_plugin’ /home/esmil/mysql-5.5.8/sql-common/client_plugin.c:126:1: note: expected ‘va_list’ but argument is of type ‘int’ /home/esmil/mysql-5.5.8/sql-common/client_plugin.c: In function ‘mysql_client_register_plugin’: /home/esmil/mysql-5.5.8/sql-common/client_plugin.c:310:5: error: incompatible type for argument 5 of ‘add_plugin’ /home/esmil/mysql-5.5.8/sql-common/client_plugin.c:126:1: note: expected ‘va_list’ but argument is of type ‘int’ make [2] : *** [libmysqld/CMakeFiles/sql_embedded.dir/__/sql-common/client_plugin.c.o] Error 1
            Hide
            ratzpo Rasmus Johansson added a comment -

            Re: Non-portable code in client plugin (fails on ARM)
            This bug was fixed in the package mysql-5.5 - 5.5.17-4ubuntu2

            ---------------
            mysql-5.5 (5.5.17-4ubuntu2) precise; urgency=low

            • d/patches/70_mysql_va_list.patch: cherry pick patch from
              upstream bug tracker to fix ARM build failure. (LP: #700982)
              • Clint Byrum <clint@ubuntu.com> Tue, 22 Nov 2011 11:00:14 -0800
            Show
            ratzpo Rasmus Johansson added a comment - Re: Non-portable code in client plugin (fails on ARM) This bug was fixed in the package mysql-5.5 - 5.5.17-4ubuntu2 --------------- mysql-5.5 (5.5.17-4ubuntu2) precise; urgency=low d/patches/70_mysql_va_list.patch: cherry pick patch from upstream bug tracker to fix ARM build failure. (LP: #700982) Clint Byrum <clint@ubuntu.com> Tue, 22 Nov 2011 11:00:14 -0800
            Hide
            ratzpo Rasmus Johansson added a comment -

            Launchpad bug id: 700982

            Show
            ratzpo Rasmus Johansson added a comment - Launchpad bug id: 700982

              People

              • Assignee:
                serg Sergei Golubchik
                Reporter:
                knielsen Kristian Nielsen
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: