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

tarfile zeroes ustar header fields unnecessarily #90021

Closed
jmroot mannequin opened this issue Nov 22, 2021 · 7 comments
Closed

tarfile zeroes ustar header fields unnecessarily #90021

jmroot mannequin opened this issue Nov 22, 2021 · 7 comments
Labels
3.9 only security fixes 3.10 only security fixes 3.11 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@jmroot
Copy link
Mannequin

jmroot mannequin commented Nov 22, 2021

BPO 45863
Nosy @vstinner, @jmroot, @ethanfurman, @miss-islington, @sobolevn
PRs
  • bpo-45863: tarfile: don't zero out header fields unnecessarily #29693
  • [3.9] bpo-45863: tarfile: don't zero out header fields unnecessarily (GH-29693) #31232
  • [3.10] bpo-45863: tarfile: don't zero out header fields unnecessarily (GH-29693) #31233
  • Fix sphinx-lint after #31097 and b878b3a #31248
  • 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 = <Date 2022-02-09.17:37:25.043>
    created_at = <Date 2021-11-22.08:01:20.884>
    labels = ['type-bug', 'library', '3.9', '3.10', '3.11']
    title = 'tarfile zeroes ustar header fields unnecessarily'
    updated_at = <Date 2022-02-10.09:08:59.472>
    user = 'https://github.com/jmroot'

    bugs.python.org fields:

    activity = <Date 2022-02-10.09:08:59.472>
    actor = 'miss-islington'
    assignee = 'none'
    closed = True
    closed_date = <Date 2022-02-09.17:37:25.043>
    closer = 'vstinner'
    components = ['Library (Lib)']
    creation = <Date 2021-11-22.08:01:20.884>
    creator = 'jmr'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 45863
    keywords = ['patch']
    message_count = 7.0
    messages = ['406744', '409228', '412923', '412930', '412931', '412932', '412984']
    nosy_count = 5.0
    nosy_names = ['vstinner', 'jmr', 'ethan.furman', 'miss-islington', 'sobolevn']
    pr_nums = ['29693', '31232', '31233', '31248']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue45863'
    versions = ['Python 3.9', 'Python 3.10', 'Python 3.11']

    @jmroot
    Copy link
    Mannequin Author

    jmroot mannequin commented Nov 22, 2021

    When using the pax format, tarfile will zero out the field in the ustar header for any values that are represented with a float, setting the correct value only in the pax header. This mainly seems to apply to the mtime. This behaviour doesn't cause problems when using an unarchiver that understands the pax header, but unarchivers that don't will extract incorrect metadata (most obviously all mtimes set to the epoch). Compatibility with such unarchivers can easily be achieved by rounding the float value to int for the ustar header only, thus at least giving mtimes that are accurate to the nearest second instead of nothing.

    @jmroot jmroot mannequin added 3.9 only security fixes 3.10 only security fixes 3.11 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Nov 22, 2021
    @jmroot
    Copy link
    Mannequin Author

    jmroot mannequin commented Dec 27, 2021

    PR has been marked stale; friendly ping.

    @vstinner
    Copy link
    Member

    vstinner commented Feb 9, 2022

    New changeset bf2d44f by Joshua Root in branch 'main':
    bpo-45863: tarfile: don't zero out header fields unnecessarily (GH-29693)
    bf2d44f

    @miss-islington
    Copy link
    Contributor

    New changeset 42f87d4 by Miss Islington (bot) in branch '3.10':
    bpo-45863: tarfile: don't zero out header fields unnecessarily (GH-29693)
    42f87d4

    @miss-islington
    Copy link
    Contributor

    New changeset b0517a1 by Miss Islington (bot) in branch '3.9':
    bpo-45863: tarfile: don't zero out header fields unnecessarily (GH-29693)
    b0517a1

    @vstinner
    Copy link
    Member

    vstinner commented Feb 9, 2022

    Thanks Joshua Root for the bug report and the fix!

    @miss-islington
    Copy link
    Contributor

    New changeset dee020a by Nikita Sobolev in branch 'main':
    Fix sphinx-lint after bpo-31097 and b878b3a (GH-31248)
    dee020a

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.9 only security fixes 3.10 only security fixes 3.11 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants