RFR: 8296812: sprintf is deprecated in Xcode 14 [v18]
Michael Hall
mik3hall at gmail.com
Thu Dec 8 03:50:20 UTC 2022
> On Dec 7, 2022, at 9:23 PM, Xue-Lei Andrew Fan <xuelei at openjdk.org> wrote:
>
> On Wed, 7 Dec 2022 21:25:11 GMT, Xue-Lei Andrew Fan <xuelei at openjdk.org <mailto:xuelei at openjdk.org>> wrote:
>
>>> Hi,
>>>
>>> May I have this update reviewed?
>>>
>>> The sprintf is deprecated in Xcode 14 because of security concerns, 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.
>>>
>>> Thanks,
>>> Xuelei
>>
>> Xue-Lei Andrew Fan has updated the pull request incrementally with one additional commit since the last revision:
>>
>> update on review feedback
>
>> With the exception of these errors in cmstypes.c
>>
>> /Users/mjh/Documents/GitHub/jdk/src/java.desktop/share/native/liblcms/cmstypes.c:3441:132: error: parameter 'SizeOfTag' set but not used [-Werror,-Wunused-but-set-parameter] void *Type_ProfileSequenceId_Read(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, cmsUInt32Number* nItems, cmsUInt32Number SizeOfTag) ^ /Users/mjh/Documents/GitHub/jdk/src/java.desktop/share/native/liblcms/cmstypes.c:5137:125: error: parameter 'SizeOfTag' set but not used [-Werror,-Wunused-but-set-parameter] void *Type_Dictionary_Read(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, cmsUInt32Number* nItems, cmsUInt32Number SizeOfTag) ^ 2 errors generated.
>>
>> I had seen this sometime back. The same workaround of adding?
>>
>> cmsUNUSED_PARAMETER(SizeOfTag); // mjh
>>
>> To the two methods, which I had noticed included elsewhere in the code, still appears to work.
>>
>
> The SizeOfTag issue was tracked with https://bugs.openjdk.org/browse/JDK-8283221 <https://bugs.openjdk.org/browse/JDK-8283221>.
Sorry, I should of mentioned that I had come across this bug report the first time I had this issue. I don’t think it was closed at the time. The --disable-warnings-as-errors seemed the only suggested workaround at the time. I thought mine was better. I’m not very familiar with these things but I assume that the fix for that bug hasn’t been merged into your pull request yet, but will be at some point.
>
>> I first noticed the sprintf issue in later releases of Xcode 13. It isn?t just Xcode 14.
>>
>
> In the [Apple Developer Documentation](https://developer.apple.com/documentation/kernel/1441083-sprintf <https://developer.apple.com/documentation/kernel/1441083-sprintf>), there is a note for sprintf, "macOS 10.12–10.13.1 Deprecated". It looks like that deprecation was backported.
I installed an old Xcode (13.1) version. Which wasn’t a very easy process and probably only was possible since I have an Apple developer account to get the download. The next time I had gone into Xcode it forced an update to 14. I have continued to use the 13.1 to allow jdk builds until trying yours with 14.1. It worked as indicated.
Thanks for the reply.
>
> -------------
>
> PR: https://git.openjdk.org/jdk/pull/11115 <https://git.openjdk.org/jdk/pull/11115>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/client-libs-dev/attachments/20221207/f5f9a99a/attachment.htm>
More information about the client-libs-dev
mailing list