Skip to content

[3.15] gh-83869: tarfile: compute next header offset using pax size for sparse file (GH-18562) - #155866

Merged
serhiy-storchaka merged 2 commits into
python:3.15from
miss-islington:backport-1a52eae-3.15
Oct 10, 2026
Merged

serhiy-storchaka merged 2 commits into
python:3.15from
miss-islington:backport-1a52eae-3.15

Conversation

@miss-islington

@miss-islington miss-islington commented Aug 15, 2026 •

Copy link
Copy Markdown
Contributor

In case of a sparse file, the tarinfo.size attribute is set to the sparse
file expanded size (pax attribute GNU.sparse.size or GNU.sparse.size) and
do not correspond to the actual size of the data block. The size of the
data block is specified by the size pax header if present or by the ustar
size header.
Moreover, for GNU sparse 1.0 files, the data block start at the beginning of
the sparse mapping and not after the sparse mapping and so the offset should
be computed from here.
(cherry picked from commit 1a52eae)

Co-authored-by: Valentin Samir valentin.samir@crans.org
Co-authored-by: Serhiy Storchaka storchaka@gmail.com

…r sparse file (pythonGH-18562)

In case of a sparse file, the tarinfo.size attribute is set to the sparse
file expanded size (pax attribute GNU.sparse.size or GNU.sparse.size) and
do not correspond to the actual size of the data block. The size of the
data block is specified by the size pax header if present or by the ustar
size header.
Moreover, for GNU sparse 1.0 files, the data block start at the beginning of
the sparse mapping and not after the sparse mapping and so the offset should
be computed from here.
(cherry picked from commit 1a52eae)

Co-authored-by: Valentin Samir <valentin.samir@crans.org>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@serhiy-storchaka
serhiy-storchaka merged commit 5c6758a into python:3.15 Oct 10, 2026
56 checks passed
@miss-islington
miss-islington deleted the backport-1a52eae-3.15 branch October 10, 2026 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants