Skip to content

tarfile zeroes ustar header fields unnecessarily #90021

Closed

Description

@jmroot
mannequin
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']

    Activity

    1. jmroot commented on Nov 22, 2021

      jmrootmannequin
      MannequinAuthor

      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.

    2. added
      3.11only security fixes
      stdlibStandard Library Python modules in the Lib/ directory
      type-bugAn unexpected behavior, bug, or error
      on Nov 22, 2021
    3. jmroot commented on Dec 27, 2021

      jmrootmannequin
      MannequinAuthor

      PR has been marked stale; friendly ping.

    4. vstinner commented on Feb 9, 2022

      @vstinner
      Member

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

    5. miss-islington commented on Feb 9, 2022

      @miss-islington
      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

    6. miss-islington commented on Feb 9, 2022

      @miss-islington
      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

    7. vstinner commented on Feb 9, 2022

      @vstinner
      Member

      Thanks Joshua Root for the bug report and the fix!

    8. miss-islington commented on Feb 10, 2022

      @miss-islington
      Contributor

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

    9. transferred this issue fromon Apr 10, 2022
    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

      3.10 (EOL)end of life3.11only security fixes3.9 (EOL)end of lifestdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions