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

client packages need my_global.h and/or my_config.h

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • 10.2.8
    • 10.2.9
    • Packaging
    • None

    Description

      after MDEV-13370 server includes got installed under /usr/include/mysql/server. But some client packages need them, e.g. mysql-python needs my_config.h.

      They shouldn't need them and mysql-python doesn't really use the included file, but some might use them and they need time to be fixed.

      Possible solution, install headers, like

      /usr/include/mysql/my_global.h

      #include "server/my_global.h"
      #warning Clients should not include this file, it's a server header. Report a bug to project maintainers!
      

      Attachments

        Issue Links

          Activity

            Thanks! So I have the following choices:

            1. Leave everything as is. This will work for MariaDB < 10.2.8, not work for MariaDB = 10.2.8, will work with a warning for MariaDB > 10.2.8

            2. Remove the redundant #include <mysql_version.h> line. This will work for MariaDB 10.2.8, will break 10.2.x, where x < 8

            3. Do some configure-time pushups to test for server/mysql_version.h availability, and if available, include that one instead of just mysql_version.h. Which will apparently work everywhere.

            It looks like #3, as ugly as it is, provides better compatibility.

            kaamos Alexey Kopytov added a comment - Thanks! So I have the following choices: 1. Leave everything as is. This will work for MariaDB < 10.2.8, not work for MariaDB = 10.2.8, will work with a warning for MariaDB > 10.2.8 2. Remove the redundant #include <mysql_version.h> line. This will work for MariaDB 10.2.8, will break 10.2.x, where x < 8 3. Do some configure-time pushups to test for server/mysql_version.h availability, and if available, include that one instead of just mysql_version.h . Which will apparently work everywhere. It looks like #3, as ugly as it is, provides better compatibility.

            Oh, right. Then the easiest fix would be this:

            --- drv_mysql.c.old     2017-09-15 10:14:09.000000000 +0200
            +++ drv_mysql.c 2017-09-15 10:13:40.000000000 +0200
            @@ -35,7 +35,6 @@
             #include <stdio.h>
             
             #include <mysql.h>
            -#include <mysql_version.h>
             #include <mysqld_error.h>
             #include <errmsg.h>
             
            @@ -50,8 +49,8 @@
             
             #define SAFESTR(s) ((s != NULL) ? (s) : "(null)")
             
            -#if !defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 80001 && \
            -  MYSQL_VERSION_ID != 80002 /* see https://bugs.mysql.com/?id=87337 */
            +#if !defined(MARIADB_BASE_VERSION) && !defined(MARIADB_VERSION_ID) && \
            +  MYSQL_VERSION_ID >= 80001 && MYSQL_VERSION_ID != 80002 /* see https://bugs.mysql.com/?id=87337 */
             typedef bool my_bool;
             #endif
             

            As far as I understand it should work for all MariaDB and MySQL versions.

            serg Sergei Golubchik added a comment - Oh, right. Then the easiest fix would be this: --- drv_mysql.c.old 2017-09-15 10:14:09.000000000 +0200 +++ drv_mysql.c 2017-09-15 10:13:40.000000000 +0200 @@ -35,7 +35,6 @@ #include <stdio.h> #include <mysql.h> -#include <mysql_version.h> #include <mysqld_error.h> #include <errmsg.h> @@ -50,8 +49,8 @@ #define SAFESTR(s) ((s != NULL) ? (s) : "(null)") -#if !defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 80001 && \ - MYSQL_VERSION_ID != 80002 /* see https://bugs.mysql.com/?id=87337 */ +#if !defined(MARIADB_BASE_VERSION) && !defined(MARIADB_VERSION_ID) && \ + MYSQL_VERSION_ID >= 80001 && MYSQL_VERSION_ID != 80002 /* see https://bugs.mysql.com/?id=87337 */ typedef bool my_bool; #endif As far as I understand it should work for all MariaDB and MySQL versions.

            kaamos, could you, please, confirm that the patch above worked for you? If not — I'll try to come up with something that does.

            serg Sergei Golubchik added a comment - kaamos , could you, please, confirm that the patch above worked for you? If not — I'll try to come up with something that does.

            @serg, sorry, I missed the last 2 comments (no emails, not even in the spam folder), so I implemented #3 from my list.

            I tested your patch just now and it works with MySQL, MariaDB 10.1 and MariaDB 10.2.8. I'm going to replace my (ugly) fix with yours. Thanks a lot!

            kaamos Alexey Kopytov added a comment - @serg, sorry, I missed the last 2 comments (no emails, not even in the spam folder), so I implemented #3 from my list. I tested your patch just now and it works with MySQL, MariaDB 10.1 and MariaDB 10.2.8. I'm going to replace my (ugly) fix with yours. Thanks a lot!

            Thanks! Pushed.

            serg Sergei Golubchik added a comment - Thanks! Pushed.

            People

              serg Sergei Golubchik
              serg Sergei Golubchik
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.