RFR: 8301197: Make sure use of printf is correct and actually needed [v3]

David Holmes dholmes at openjdk.org
Mon Apr 7 05:27:50 UTC 2025


On Fri, 4 Apr 2025 13:35:22 GMT, Magnus Ihse Bursie <ihse at openjdk.org> wrote:

>> 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.

Ah I see. So basically the only time we actually need `printf` as far as I can see is when there are embedded newlines in the output string? We could have used `printf` without `%s` format specifiers whenever we are substituting a variable.

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

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


More information about the build-dev mailing list