RFR: 8301197: Make sure use of printf is correct and actually needed
David Holmes
dholmes at openjdk.org
Fri Apr 4 02:38:54 UTC 2025
On Thu, 3 Apr 2025 13:36:16 GMT, Magnus Ihse Bursie <ihse at 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.
Overall looks good to me.
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?
-------------
PR Review: https://git.openjdk.org/jdk/pull/24415#pullrequestreview-2741631300
PR Review Comment: https://git.openjdk.org/jdk/pull/24415#discussion_r2027997961
More information about the build-dev
mailing list