New submission from Zack Weinberg <>:

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 ).

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 <>
Python-bugs-list mailing list

Reply via email to