Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8336291

[11u] update for deprecated sprintf for jdk.pack

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • 11
    • core-libs
    • None

      Build failed on the recent macos-13 GHA platform (XCode 14, clang 14) since `sprintf` is deprecated in this platform and has to be replaced in the codebase (see [1]).

      This is a JDK11U specific issue, since jdk.pack was removed in later OpenJDK versions.


      [1]
      ```
      src/jdk.pack/share/native/common-unpack/unpack.cpp: sprintf(message, "@" ERROR_FORMAT ": magic/ver = "
      src/jdk.pack/share/native/common-unpack/unpack.cpp: sprintf((char*)buf.ptr, "0x%08x", value.i);
      src/jdk.pack/share/native/common-unpack/unpack.cpp: sprintf((char*)buf.ptr, "0x" LONG_LONG_HEX_FORMAT, value.l);
      src/jdk.pack/share/native/common-unpack/unpack.cpp: if (message[0] == '@') { // secret convention for sprintf
      src/jdk.pack/share/native/common-unpack/unpack.h: const char* saveIntStr(int num) { char buf[30]; sprintf(buf, "%d", num); return saveStr(buf); }
      src/jdk.pack/share/native/common-unpack/utils.cpp: sprintf(message, "@assert failed: %s\n", p);
      src/jdk.pack/share/native/common-unpack/utils.cpp: sprintf(fname, "mtr%d.txt", getpid());
      src/jdk.pack/share/native/common-unpack/bands.cpp: sprintf(bp, "#%d/%d", bn, le_kind); bp += strlen(bp);
      src/jdk.pack/share/native/common-unpack/bands.cpp: if (le_bci != 0) { sprintf(bp, "/bci%d", le_bci); bp += strlen(bp); }
      src/jdk.pack/share/native/common-unpack/bands.cpp: if (le_back != 0) { sprintf(bp, "/back%d", le_back); bp += strlen(bp); }
      src/jdk.pack/share/native/common-unpack/bands.cpp: if (le_len != 0) { sprintf(bp, "/len%d", le_len); bp += strlen(bp); }
      src/jdk.pack/share/native/common-unpack/coding.cpp: sprintf(maxS, "%d", max);
      src/jdk.pack/share/native/common-unpack/coding.cpp: sprintf(minS, "%d", min);
      src/jdk.pack/share/native/common-unpack/coding.cpp: sprintf((char*)buf.ptr, "(%d,%d,%d,%d) L=%d r=[%s,%s]",
      ```

            avieiro Antonio Vieiro
            avieiro Antonio Vieiro
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: