RFR: 8301753: AppendFile needs to add a new line to be compatible with old make
Magnus Ihse Bursie
ihse at openjdk.org
Wed Feb 8 13:51:43 UTC 2023
On Tue, 7 Feb 2023 20:56:01 GMT, Leonid Mesnik <lmesnik at openjdk.org> wrote:
> The newline is added to be compatible with old make 3.81 which is still used on MacOSX.
> Fixed actually by dnsimon.
I don't think this fix is correct. Look again at the documentation of make 4+ `$(file)` command:
"When writing files, text will be written to the file. If text does not already end in a newline a final newline will be written (even if text is the empty string)."
That is not what this patch is doing. It is unconditionally appending a newline to the string.
It might be the case that all places that we currently call this function lack a trailing newline, and if so, this fix is going to "work". But if not, it is going to create an additional empty line.
And even it it would happen to "work" for all our current code, the behavior would still not be the same as for make 4+, so any future calls might break.
-------------
Changes requested by ihse (Reviewer).
PR: https://git.openjdk.org/jdk/pull/12461
More information about the build-dev
mailing list