Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8276667

Support content ordering and SOURCE_DATE_EPOCH for Jar, Jmod, and underlying ZipOutputStream

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Withdrawn
    • Icon: P4 P4
    • None
    • core-libs
    • None
    • behavioral
    • minimal
    • Hide
      There is minimal compatibility risk with this change as file ordering in Jar's/Jmods was not defined previously, and behavioral change when SOURCE_DATE_EPOCH is set should fall inline with what the standard for this setting implies.
      Show
      There is minimal compatibility risk with this change as file ordering in Jar's/Jmods was not defined previously, and behavioral change when SOURCE_DATE_EPOCH is set should fall inline with what the standard for this setting implies.
    • Java API, Use or define an environment variable
    • Implementation

      This CSR relates to enhancement https://bugs.openjdk.java.net/browse/JDK-8276400 (openjdk image Jars, Zips and Jmods built from the same source are not reproducible). The essence to resolving the issue of reproducibility for Jar and Jmod's is provided by PR: https://github.com/openjdk/jdk/pull/6268, and involves supporting a "Behavioral change to Jar, Jmod and ZipOutputStream" and "Dependence on an environment variable". The behavioral changes are as follows:

      • Jar and Jmod currently produce "zips" whose contents are in a non-deterministic file order. This CSR will ensure the Jar files are stored in sorted order, and for Jmods each "Section" (eg.classes) is sorted.
      • Both Jar and Jmod use the underlying ZipOutputStream to write the "zip" content. The current implementation writes new ZipEntry "last modified" times as the System.currentTimeMillis(). This CSR will extend this behavior to detect if the standardized SOURCE_DATE_EPOCH environment variable is set, and if it is use that time in milliseconds as the new ZipEntry "last modified" time. If the SOURCE_DATE_EPOCH environment variable is not set, then the behavior is unchanged.

            aleonard Andrew Leonard
            aleonard Andrew Leonard
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: