[New-bugs-announce] [issue38726] Add equivalent of `gzip -n` (omit timestamp and original file name) to tarfile module's auto-compression support

Zack Weinberg report at bugs.python.org
Wed Nov 6 15:12:04 EST 2019


New submission from Zack Weinberg <zackw at panix.com>:

Recent versions of the gzip command-line utility have an option `-n` which causes it to omit the FNAME field of the gzip file header, and write out the MTIME field as zero.  Both of these properties are desirable when constructing reproducible build artifacts (see https://reproducible-builds.org/ ).

Right now, it's possible to get the `gzip` module to do the same thing (it's not documented, but it's possible; see bug 38725) but, as far as I can tell, if you use `tarfile`'s "w:gz" or "w|gz" modes you will always get a timestamp and a filename in the output.  Please add `w[:|]gzn`, or something like that, that behaves as-if the output were piped through `gzip -n`.

(It might make sense to remove the manual creation of a gzip file header from the tarfile module at the same time; it looks like this code predates the addition of the gzip module to the stdlib.)

----------
messages: 356151
nosy: zwol
priority: normal
severity: normal
status: open
title: Add equivalent of `gzip -n` (omit timestamp and original file name) to tarfile module's auto-compression support

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38726>
_______________________________________


More information about the New-bugs-announce mailing list