Skip to content

Conversation

@heathdutton
Copy link

@heathdutton heathdutton commented Dec 24, 2025

When processing GNU long name headers, tarfile reads the actual name from data blocks but the second header's name field contains garbage. The V7 directory detection in frombuf() could incorrectly mark regular files as directories if this garbage ended with '/'.

This fix re-applies the V7 directory detection after patching the actual long name, correcting any type corruption caused by the garbage name data.

Fixes #141707

@bedevere-app
Copy link

bedevere-app bot commented Dec 24, 2025

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@python-cla-bot
Copy link

python-cla-bot bot commented Dec 24, 2025

All commit authors signed the Contributor License Agreement.

CLA signed

When processing GNU long name headers, the name field in the second
header contains garbage data. The V7 directory detection logic in
frombuf() would incorrectly mark regular files as directories if this
garbage ended with '/'. Re-apply the detection after patching the
actual long name to correct any type corruption.
@heathdutton heathdutton force-pushed the gh-141707-fix-tarfile-gnulong branch from 8e61d0b to 5186da2 Compare December 24, 2025 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect parsing of TarInfo header when GNU long name and type AREGTYPE are combined

1 participant