classification
Title: tarfile zeroes ustar header fields unnecessarily
Type: behavior Stage: patch review
Components: Library (Lib) Versions: Python 3.11, Python 3.10, Python 3.9
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: jmr
Priority: normal Keywords: patch

Created on 2021-11-22 08:01 by jmr, last changed 2021-11-22 08:23 by jmr.

Pull Requests
URL Status Linked Edit
PR 29693 open jmr, 2021-11-22 08:23
Messages (1)
msg406744 - (view) Author: Joshua Root (jmr) * Date: 2021-11-22 08:01
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.
History
Date User Action Args
2021-11-22 08:23:22jmrsetkeywords: + patch
stage: patch review
pull_requests: + pull_request27931
2021-11-22 08:01:20jmrcreate