RFR: 8283315: jrt-fs.jar not always deterministically built

Magnus Ihse Bursie ihse at openjdk.java.net
Thu Mar 17 11:24:32 UTC 2022


On Thu, 17 Mar 2022 11:09:24 GMT, Andrew Leonard <aleonard at openjdk.org> wrote:

> JarArchive.gmk uses an un-sorted jar @<file list\>, thus depending on exactly how that list gets ordered by relevant OS querys. Such queries can differ in order on different CPU architectures (Intel vs AMD).
> 
> This PR adds a "sort" to the jar @<file list\> contents.
> 
> Signed-off-by: Andrew Leonard <anleonar at redhat.com>

Changes requested by ihse (Reviewer).

make/common/JarArchive.gmk line 196:

> 194:       if [ "`$(WC) -l $$($1_BIN)/_the.$$($1_JARNAME)_contents | $(AWK) '{ print $$$$1 }'`" -gt "0" ]; then \
> 195:         $(ECHO) "  updating" `$(WC) -l $$($1_BIN)/_the.$$($1_JARNAME)_contents | $(AWK) '{ print $$$$1 }'` files && \
> 196:         $(CAT) $$($1_BIN)/_the.$$($1_JARNAME)_contents | $(SORT) > $$($1_BIN)/_the.$$($1_JARNAME)_contents_sorted && \

I'm very grateful that you found this and fixed it, but this code could really hand you a ["Useless Use of Cat Award"](https://porkmail.org/era/unix/award#cat). :-D

`sort in-file > out-file` is much better.

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

PR: https://git.openjdk.java.net/jdk/pull/7852



More information about the build-dev mailing list