RFR: 8301197: Make sure use of printf is correct and actually needed [v3]
Magnus Ihse Bursie
ihse at openjdk.org
Mon Apr 7 09:58:00 UTC 2025
On Mon, 7 Apr 2025 05:25:39 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> 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.
Yes, that, or that we need additional formatting, such as "%22s" where we want to align certain fields. Embedded `\n` can in theory be replaced with multiple calls to echo, but in the end it is a matter of judgement which is to prefer.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24415#discussion_r2030895994
More information about the build-dev
mailing list