[jdk17u-dev] RFR: 8296812: sprintf is deprecated in Xcode 14

Aleksey Shipilev shade at openjdk.org
Tue Jan 9 11:12:37 UTC 2024


On Fri, 27 Oct 2023 16:09:10 GMT, Elif Aslan <duke at openjdk.org> wrote:

> https://developer.apple.com/news/?id=y5mjxqmn
> 
> Starting November 1, 2023, the Apple notary service will no longer accept uploads from altool or Xcode 13 or earlier. 
> 
> 
> This is not a clean backport and this pull request contains a backport of the closed bug [JDK-8296812](https://bugs.openjdk.org/browse/JDK-8296812) commit [f1522c648c2e](https://github.com/openjdk/jdk/commit/478ef389dc3767edfbe21d10a7f7f1522c648c2e).
> 
> Conflicts includes:
> 
> -  whitespace conflicts on src/hotspot/share/utilities/utf8.cpp
> 
> -  missing src/hotspot/share/jfr/support/jfrSymbolTable.cpp 
> 
> -  context difference on src/hotspot/cpu/aarch64/vm_version_aarch64.cpp
> 
> The sprintf is deprecated in Xcode 14 and the use of it causing building failure. The build could pass if warnings are disabled for codes that use sprintf method. For the long run, the sprintf could be replaced with snprintf. This patch is trying to check if snprintf could be used.
> 
> Testing:
> 
> GHA tested.
> Successfull tier1,tier2,tier3 and jck tests for linux platforms.
> Successfull tier1 and tier2 for windows.

This looks generally fine, but I think there is an accidental change that crept in. Otherwise the backport looks similar to what mainline does.

I see there are many linked issues to this bug, but all of them look like dealing with other places, and they should probably be considered for future backports.

src/hotspot/cpu/aarch64/vm_version_aarch64.cpp line 235:

> 233:   int buf_used_len = os::snprintf_checked(buf, sizeof(buf), "0x%02x:0x%x:0x%03x:%d", _cpu, _variant, _model, _revision);
> 234:   if (_model2) os::snprintf_checked(buf + buf_used_len, sizeof(buf) - buf_used_len, "(0x%03x)", _model2);
> 235: #define ADD_FEATURE_IF_SUPPORTED(id, name, bit) if (_features & CPU_##id) strcat(buf, ", " #name);

Original commit does not add `#` to `#name`.

-------------

Changes requested by shade (Reviewer).

PR Review: https://git.openjdk.org/jdk17u-dev/pull/1930#pullrequestreview-1809767253
PR Review Comment: https://git.openjdk.org/jdk17u-dev/pull/1930#discussion_r1445125907


More information about the jdk-updates-dev mailing list