Skip to content
Snippets Groups Projects
Closed mat2 changes zip files compression level (use case: reproducible builds)
  • View options
  • mat2 changes zip files compression level (use case: reproducible builds)

  • View options
  • Closed Issue created by Denis Carikli

    Hi,

    In ZipParser, when creating new zip files, the compression is hardcoded to zipfile.ZIP_DEFLATED.

    As I understand, mat2 main use case is to remove the metadata from files, so I guess that in this case, if mat2 changes the compression of the zip files it's not an issue.

    However here my use case is a bit different: I want to generate several zip files with inside a png file and a text file to create a bootanimation.zip[1] for an Android distribution. The zip files are generated with a script from a single svg file.

    In order to make it reproducible, I used mat2, which makes the zip reproducible, but it also changes the compression of the zip from ZIP_STORED (no compression), to zipfile.ZIP_DEFLATED, and Android only accepts uncompressed zips.

    This bug is probably similar to the bug #158 (closed).

    Would it be desirable (or not) to enable mat2 to detect the zip compression and, when recreating the zip, to reuse the same compression level.

    And if it's useful, it could also be dangerous in some situation, for instance if some zip files are somehow watermarked through the compression level of the zip or individual files.

    So if adding the ability to use the same compression level makes sense, would it also make sense to add some option to use mat2 for reproducible builds?

    It could look like that in the man:

    -C, --keep-compression-levels

    Keep the compression level of the various formats (at this time only zip is implemented).

    References:

    [1]https://android.googlesource.com/platform/frameworks/base/+/master/cmds/bootanimation/FORMAT.md

    Linked items ... 0

  • Activity

    • All activity
    • Comments only
    • History only
    • Newest first
    • Oldest first
    Loading Loading Loading Loading Loading Loading Loading Loading Loading Loading