Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
BaseArchiver.extract_item()decides whether an extraction failure was caused by the Windows260-character
MAX_PATHlimit like this:The real on-disk path is
dest_dir + os.sep + src_path, not the sum of the two lengths, anddest_diris not normalised —unpack()accepts a relative destination. So the check under-counts:the library misses the case it exists to detect, and the user gets a bare
FileNotFoundError(
[WinError 3]) instead of the actionable "enable long paths" message.The change
Compare the length of the path that will actually be created:
One expression, no new validation, the threshold is unchanged.
Verification
Reproduced on a host whose CPython is not long-path aware (a small launcher loading the stock
python312.dll), so the OS itself refuses the path — no monkeypatching:dest_dir, 84-character tar member: the old formula computes 90(≤ 260) while the real path is 332 characters;
[WinError 3] ...surfaced asFileNotFoundError;WindowsLongPathErrorwith the "enable long paths" hint.A control case with a genuinely short path still raises the original
FileNotFoundError, so the newcheck does not swallow other failures, and a portable variant of the harness covers 333/482-character
paths with
LongPathsEnabled=1.blackis clean on the changed file.The CLA has been signed.