You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Activity
jmroot commentedon 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 commentedon Dec 27, 2021
PR has been marked stale; friendly ping.
vstinner commentedon 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 commentedon Feb 9, 2022
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 commentedon Feb 9, 2022
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 commentedon Feb 9, 2022
Thanks Joshua Root for the bug report and the fix!
miss-islington commentedon Feb 10, 2022
New changeset dee020a by Nikita Sobolev in branch 'main':
Fix sphinx-lint after bpo-31097 and b878b3a (GH-31248)
dee020a