Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve zip file reproducibility #1602

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Apr 15, 2024

  1. Improve zip file reproducibility

    We currently use the ZipArchiveEntry(File, String) constructor when
    creating a zip file entry for Universal/packageBin. This constructor
    reads mtime, atime, and ctime from the File and adds them to the 5455
    extended header in the zip file. When we call setTime on the entry, it
    only changes the mtime field--the atime and ctime are the same values
    from the file and are likely to be different across builds and break
    reproducibility.
    
    To fix this, we use the ZipArchiveEntry(String) constructor which does
    not read any file metadata, and only uses information we directly
    provided to it. We now provie the source epoch via setLastModifiedTime
    since that continues to use the 5455 extended header but only for mtime.
    We also ensure directories have a trailing slash in the entry name,
    since that was previously done by the other constructor.
    
    With this change, when using SOURCE_DATE_EPOCH, zip files created with
    Universal/packageBin are now byte-for-byte exactly the same.
    stevedlawrence committed Apr 15, 2024
    Configuration menu
    Copy the full SHA
    25fe914 View commit details
    Browse the repository at this point in the history