On Fri, 4 Apr 2025 02:35:07 GMT, David Holmes <dhol...@openjdk.org> wrote:

>> We have been sloppy in our use of `printf` in make code. Most of the time, 
>> we should really use `echo` instead. If we do need to use `printf`, we 
>> should never inline make or shell variables into the formatting string, 
>> since they may contain `%` which will be interpreted as formatting. Instead, 
>> we should always use `%s` and pass the variable as an argument to `printf`.
>> 
>> I've checked the entire code base for usages of $PRINTF, and converted most 
>> of them to $ECHO, and made sure the remaining ones are correct. I also 
>> discovered some additional ugly stuff in relation to this, which I fixed.
>
> make/common/modules/GensrcCommon.gmk line 45:
> 
>> 43:  $$(call MakeTargetDir)
>> 44:  $(PRINTF) "jdk=%s\nfull=%s\nrelease=%s\n" \
>> 45:      $(VERSION_NUMBER) $(VERSION_STRING) $(VERSION_SHORT) > $$@
> 
> Can't this just use echo like you did with the windows version elsewhere?

No, there are embedded `\n` and that does not work with echo. I could split it 
into three consecutive lines but I don't think that would be a gain.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24415#discussion_r2028829226

Reply via email to