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

John Neffenger jgneff at openjdk.java.net
Wed Dec 1 18:24:28 UTC 2021


On Wed, 1 Dec 2021 18:02:05 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 incrementally with one additional commit since the last revision:
> 
>   Update src/jdk.jlink/share/classes/jdk/tools/jmod/JmodOutputStream.java
>   
>   Co-authored-by: Magnus Ihse Bursie <mag at icus.se>

I'm testing it now. So far, it's working great!

I found one boundary problem. The magic instant of `1980-01-01T00:00:00Z` triggers an extended header with the wrong time:


  file last modified on (DOS date/time):          1980 Jan 1 00:00:00
  file last modified on (UT extra field modtime): 1980 Jan 1 00:00:00 local
  file last modified on (UT extra field modtime): 1980 Jan 1 08:00:00 UTC


One second later `1980-01-01T00:00:01Z` works fine (considering the rounding down to even seconds):


  file last modified on (DOS date/time):          1980 Jan 1 00:00:00

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

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


More information about the compiler-dev mailing list