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

Server build failure on MacOS Monterey with clang version 14.0.0

Details

    • Bug
    • Status: Open (View Workflow)
    • Critical
    • Resolution: Unresolved
    • 10.5, 10.6, 10.11, 11.2(EOL), 11.4, 11.5(EOL)
    • 11.8
    • Compiling
    • None

    Description

      Compilation failure caused by using the C API function sprintf() that marked as deprecated. The goal of this task is to fix found issues in order to be able to build server on MacOS Monterey. The scope of this task is very limited and it doesn't intend to replace all occurrences of sprintf () throughout the source code.

      Attachments

        Issue Links

          Activity

            I think that the bug title is misleading and the current fix is incomplete. We should simply replace all use of the unsafe-by-design C90 library function sprintf() with the C99 library function snprintf(), which we have relied on at least starting with MariaDB Server 10.2. Please consider which one is more pleasant to read:

            #ifdef __clang__
            #pragma clang diagnostic push
            #pragma clang diagnostic ignored "-Wdeprecated-declarations"
            #endif
              sprintf(buf, "CODE#%d", code);
            #ifdef __clang__
            #pragma clang diagnostic pop
            #endif
            

            or

              snprintf(buf, sizeof buf, "CODE#%d", code);
            

            marko Marko Mäkelä added a comment - I think that the bug title is misleading and the current fix is incomplete. We should simply replace all use of the unsafe-by-design C90 library function sprintf() with the C99 library function snprintf() , which we have relied on at least starting with MariaDB Server 10.2. Please consider which one is more pleasant to read: #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" #endif sprintf (buf, "CODE#%d" , code); #ifdef __clang__ #pragma clang diagnostic pop #endif or snprintf(buf, sizeof buf, "CODE#%d" , code);

            In any compilation unit that includes include/violite.h, all deprecation warnings would be suppressed, originally in order to avoid a deprecation warning for OpenSSL when Apple prepared a move to LibreSSL. It turns out that we link with OpenSSL from Homebrew nowadays, and all those deprecation warnings actually are for the inherently unsafe sprintf function. I think that this deprecation warning needs to be removed and fixed as part of this task.

            marko Marko Mäkelä added a comment - In any compilation unit that includes include/violite.h , all deprecation warnings would be suppressed, originally in order to avoid a deprecation warning for OpenSSL when Apple prepared a move to LibreSSL. It turns out that we link with OpenSSL from Homebrew nowadays, and all those deprecation warnings actually are for the inherently unsafe sprintf function. I think that this deprecation warning needs to be removed and fixed as part of this task.

            This seems to duplicate MDEV-33714, which Gosselin had filed some time earlier. It would be nice to replace all inherently unsafe sprintf() calls.

            marko Marko Mäkelä added a comment - This seems to duplicate MDEV-33714 , which Gosselin had filed some time earlier. It would be nice to replace all inherently unsafe sprintf() calls.
            Gosselin Dave Gosselin added a comment - Please also see this PR: https://github.com/MariaDB/server/pull/2432

            People

              shulga Dmitry Shulga
              shulga Dmitry Shulga
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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