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

Magnus Ihse Bursie ihse at openjdk.org
Thu Apr 3 13:51:57 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.

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

Commit messages:
 - 8301197: Make sure use of printf is correct and actually needed

Changes: https://git.openjdk.org/jdk/pull/24415/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=24415&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8301197
  Stats: 142 lines in 16 files changed: 15 ins; 1 del; 126 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