RFR: 8276400: openjdk image Jars, Zips and Jmods built from the same source are not reproducible

Andrew Leonard aleonard at openjdk.java.net
Fri Nov 5 12:34:13 UTC 2021


On Thu, 4 Nov 2021 20:56:45 GMT, Andrew Leonard <aleonard at openjdk.org> wrote:

> This PR enables reproducible Jars, Jmods and openjdk image zip files (eg.src.zip).
> It provides support for SOURCE_DATE_EPOCH for Jar, Jmod and underlying ZipOutputStream's.
> It fixes the following keys issues relating to reproducibility:
> - Jar and ZipOutputStream are not SOURCE_DATE_EPOCH aware
>   - Jar and ZipOutputStream now detect SOURCE_DATE_EPOCH environment setting
> - Jar and Jmod file content ordering was non-determinsitic
>   - Fixes to Jar and Jmod main's to ensure sorted classes content ordering
> - openjdk image zip file generation used "zip" which is non-determinsitic
>   - New openjdk build tool "GenerateZip" which produces the final determinsitic zip files as part of the build and also detects SOURCE_DATE_EPOCH
> 
> Signed-off-by: Andrew Leonard <anleonar at redhat.com>

> _Mailing list message from [Alan Bateman](mailto:Alan.Bateman at oracle.com) on [build-dev](mailto:build-dev at mail.openjdk.java.net):_
> 
> On 05/11/2021 11:39, Magnus Ihse Bursie wrote:
> 
> > :
> > I agree with Alan's comment above. First of all, to be absolutely clear, I think this is a very worthy goal, and much overdue. I'll do my best to help get this implemented.
> 
> One suggestion is to separate out the issue of ordering of entries (in zip/JAR and JMOD) and whether it would be the default. There may be trade-offs to discuss, also whether it's limited to just new zip/JAR files or updates to existing zip/JARs files.
> 
> -Alan

Yes, makes sense, @LanceAndersen already picked up on that for file sorting. We can discuss in a separate PR.

So picking up on what @magicus suggested as well, what I shall do is split this into 3:

1) GenerateZip openjdk build tool
2) Changes to Jar and Jmod main's to ensure file ordering
3) Jar, Jmod and/or ZipOutputStream changes to support a "source-date" specification

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

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


More information about the compiler-dev mailing list