RFR: 8276764: Enable deterministic file content ordering for Jar and Jmod
Andrew Leonard
aleonard at openjdk.java.net
Thu Nov 18 09:35:43 UTC 2021
On Wed, 17 Nov 2021 21:45:45 GMT, Mandy Chung <mchung at openjdk.org> wrote:
>> Both jar and jmod utilise java.io file operations whose methods define no ordering of the return file lists, and in fact rely on OS query file ordering, which can differ by underlying OS architecture.
>> This PR adds sort processing to the creation of such jar's and jmod's to enable a deterministic content ordering.
>>
>> Signed-off-by: Andrew Leonard <anleonar at redhat.com>
>
> src/jdk.jlink/share/classes/jdk/tools/jmod/JmodTask.java line 803:
>
>> 801: out.writeEntry(in, section, name);
>> 802: }
>> 803: }
>
> jmod change is okay.
thanks
> test/jdk/tools/jar/ContentOrder.java line 79:
>
>> 77: @Test
>> 78: public void test1() throws IOException {
>> 79: mkdir("testjar/Ctest1 testjar/Btest2/subdir1 testjar/Atest3");
>
> I suggest to make `mkdir` and `touch` to take a vararg of String or Path and the method body concatenates the input strings to build the command line.
I copied this from another test, but your suggestion makes sense
-------------
PR: https://git.openjdk.java.net/jdk/pull/6395
More information about the core-libs-dev
mailing list