◐ Shell
clean mode source ↗

bpo-45863: tarfile: don't zero out header fields unnecessarily by jmroot · Pull Request #29693 · python/cpython

vstinner

Numeric fields of type float, notably mtime, can't be represented
exactly in the ustar header, so the pax header is used. But it is
helpful to set them to the nearest int (i.e. second rather than
nanosecond precision mtimes) in the ustar header as well, for the
benefit of unarchivers that don't understand the pax header.

Add test for tarfile.TarInfo.create_pax_header to confirm correct
behaviour.

vstinner

@blurb-it

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request

Feb 9, 2022
…nGH-29693)

Numeric fields of type float, notably mtime, can't be represented
exactly in the ustar header, so the pax header is used. But it is
helpful to set them to the nearest int (i.e. second rather than
nanosecond precision mtimes) in the ustar header as well, for the
benefit of unarchivers that don't understand the pax header.

Add test for tarfile.TarInfo.create_pax_header to confirm correct
behaviour.
(cherry picked from commit bf2d44f)

Co-authored-by: Joshua Root <jmr@macports.org>

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request

Feb 9, 2022
…nGH-29693)

Numeric fields of type float, notably mtime, can't be represented
exactly in the ustar header, so the pax header is used. But it is
helpful to set them to the nearest int (i.e. second rather than
nanosecond precision mtimes) in the ustar header as well, for the
benefit of unarchivers that don't understand the pax header.

Add test for tarfile.TarInfo.create_pax_header to confirm correct
behaviour.
(cherry picked from commit bf2d44f)

Co-authored-by: Joshua Root <jmr@macports.org>

miss-islington added a commit that referenced this pull request

Feb 9, 2022
)

Numeric fields of type float, notably mtime, can't be represented
exactly in the ustar header, so the pax header is used. But it is
helpful to set them to the nearest int (i.e. second rather than
nanosecond precision mtimes) in the ustar header as well, for the
benefit of unarchivers that don't understand the pax header.

Add test for tarfile.TarInfo.create_pax_header to confirm correct
behaviour.
(cherry picked from commit bf2d44f)

Co-authored-by: Joshua Root <jmr@macports.org>

miss-islington added a commit that referenced this pull request

Feb 9, 2022
)

Numeric fields of type float, notably mtime, can't be represented
exactly in the ustar header, so the pax header is used. But it is
helpful to set them to the nearest int (i.e. second rather than
nanosecond precision mtimes) in the ustar header as well, for the
benefit of unarchivers that don't understand the pax header.

Add test for tarfile.TarInfo.create_pax_header to confirm correct
behaviour.
(cherry picked from commit bf2d44f)

Co-authored-by: Joshua Root <jmr@macports.org>

@jmroot jmroot deleted the tarfile-headers branch

February 9, 2022 21:36

This was referenced

Feb 10, 2022

hello-adam pushed a commit to hello-adam/cpython that referenced this pull request

Jun 2, 2022
…nGH-29693)

Numeric fields of type float, notably mtime, can't be represented
exactly in the ustar header, so the pax header is used. But it is
helpful to set them to the nearest int (i.e. second rather than
nanosecond precision mtimes) in the ustar header as well, for the
benefit of unarchivers that don't understand the pax header.

Add test for tarfile.TarInfo.create_pax_header to confirm correct
behaviour.
(cherry picked from commit bf2d44f)

Co-authored-by: Joshua Root <jmr@macports.org>