Skip to content

Add equivalent of gzip -n (omit timestamp and original file name) to tarfile module's auto-compression support #82907

Closed

Description

@zwol
mannequin
BPO 38726

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2019-11-06.20:12:04.355>
labels = []
title = "Add equivalent of `gzip -n` (omit timestamp and original file name) to tarfile module's auto-compression support"
updated_at = <Date 2019-11-06.20:12:04.355>
user = 'https://bugs.python.org/zwol'

bugs.python.org fields:

activity = <Date 2019-11-06.20:12:04.355>
actor = 'zwol'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = []
creation = <Date 2019-11-06.20:12:04.355>
creator = 'zwol'
dependencies = []
files = []
hgrepos = []
issue_num = 38726
keywords = []
message_count = 1.0
messages = ['356151']
nosy_count = 1.0
nosy_names = ['zwol']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = None
url = 'https://bugs.python.org/issue38726'
versions = []

Linked PRs

Activity

  1. zwol commented on Nov 6, 2019

    zwolmannequin
    MannequinAuthor

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

  2. transferred this issue fromon Apr 10, 2022
  3. dahlend commented on Jan 20, 2023

    @dahlend

    The "bug 38725" in the original comment now directs to this issue:
    #82906

  4. added
    stdlib
    on Nov 27, 2023
  5. added
    docs
    on May 21, 2026
  6. serhiy-storchaka commented on May 21, 2026

    @serhiy-storchaka
    Member

    The mtime parameter for tarfile.open() was added in #75707. Now we only need to specially document the 0 value, like in the gzip module documentation.

  7. omkar-334 commented on May 22, 2026

    @omkar-334
    Contributor

    hi @serhiy-storchaka can I work on this

  8. serhiy-storchaka commented on May 22, 2026

    @serhiy-storchaka
    Member

    Go ahead, @omkar-334.

  9. added a commit that references this issue on May 22, 2026
  10. added a commit that references this issue on May 22, 2026
  11. added a commit that references this issue on May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docseasystdlib

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions