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

Magnus Ihse Bursie ihse at openjdk.org
Fri Apr 4 14:22:17 UTC 2025


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

Magnus Ihse Bursie has updated the pull request incrementally with three additional commits since the last revision:

 - One more
 - Ooops...
 - Use echo -n where possible

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/24415/files
  - new: https://git.openjdk.org/jdk/pull/24415/files/08a7dc92..db4cdc8a

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=24415&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=24415&range=00-01

  Stats: 19 lines in 5 files changed: 2 ins; 0 del; 17 mod
  Patch: https://git.openjdk.org/jdk/pull/24415.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/24415/head:pull/24415

PR: https://git.openjdk.org/jdk/pull/24415


More information about the build-dev mailing list