RFR: 8276766: Enable jar and jmod to produce deterministic timestamped content [v4]

Lance Andersen lancea at openjdk.java.net
Wed Nov 24 18:15:09 UTC 2021


On Tue, 23 Nov 2021 20:29:15 GMT, Andrew Leonard <aleonard at openjdk.org> wrote:

>> Add a new --source-date <TIMESTAMP> (epoch seconds) option to jar and jmod to allow specification of time to use for created/updated jar/jmod entries. This then allows the ability to make the content deterministic.
>> 
>> Signed-off-by: Andrew Leonard <anleonar at redhat.com>
>
> Andrew Leonard has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains five commits:
> 
>  - 8276766: Enable jar and jmod to produce deterministic timestamped content
>    
>    Signed-off-by: Andrew Leonard <anleonar at redhat.com>
>  - 8276766: Enable jar and jmod to produce deterministic timestamped content
>    
>    Signed-off-by: Andrew Leonard <anleonar at redhat.com>
>  - 8276766: Enable jar and jmod to produce deterministic timestamped content
>    
>    Signed-off-by: Andrew Leonard <anleonar at redhat.com>
>  - 8276766: Enable jar and jmod to produce deterministic timestamped content
>    
>    Signed-off-by: Andrew Leonard <anleonar at redhat.com>
>  - 8276766: Enable jar and jmod to produce deterministic timestamped content
>    
>    Signed-off-by: Andrew Leonard <anleonar at redhat.com>

Thank you for your efforts here.

I just happened to notice that you created a [CSR](https://bugs.openjdk.java.net/browse/JDK-8277755), which is great, thank you.

Please add an explanation as to why the compatibility risk is minimal as that field is currently empty to the CSR.

The current version of the PR looks reasonable.  Please see a few additional comments below

src/jdk.jartool/share/classes/sun/tools/jar/Main.java line 2290:

> 2288:     private void setSourceDate(ZipEntry e, long origTime) {
> 2289:         if (sourceDate != -1) {
> 2290:           e.setTimeLocal(LocalDateTime.ofEpochSecond(sourceDate, 0, ZoneOffset.UTC));

The above could potentially throw a DateTimeException which may be OK but I would sanity check there are no issues

src/jdk.jartool/share/man/jar.1 line 1:

> 1: .\" Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.

The man pages are maintained in the close repository

test/jdk/tools/jar/JarEntryTime.java line 129:

> 127:         // Make a jar file from that directory structure with
> 128:         // --source-date set to epoch seconds 1647302400 (15/03/2022)
> 129:         long sourceDate = 1647302400L;

Please consider  adding a few before Epoch test values.

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

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


More information about the compiler-dev mailing list