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

Magnus Ihse Bursie ihse at openjdk.org
Mon Apr 7 20:38:15 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.

This pull request has now been integrated.

Changeset: 42dc99ea
Author:    Magnus Ihse Bursie <ihse at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/42dc99eac16c46f1b403cce1dd14c6bda50eae70
Stats:     146 lines in 16 files changed: 17 ins; 1 del; 128 mod

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

Reviewed-by: erikj

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

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


More information about the build-dev mailing list