Skip to content

gh-143663: Perform path normalization in TarFile.extractall() - #143665

Merged
ethanfurman merged 10 commits into
python:mainfrom
0xd6cb6d73:fix-issue-143663
Nov 19, 2026
Merged

ethanfurman merged 10 commits into
python:mainfrom
0xd6cb6d73:fix-issue-143663

Conversation

@0xd6cb6d73

@0xd6cb6d73 0xd6cb6d73 commented Jan 10, 2026 •

Copy link
Copy Markdown
Contributor

This PR fixes an issue on Windows caused by non-normalized destination paths when calling extractall().

@python-cla-bot

python-cla-bot Bot commented Jan 10, 2026 •

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

@picnixz

picnixz commented Jan 10, 2026

Copy link
Copy Markdown
Member

Please do not open a PR until the bug has been acknowledged. We can't just normalize all paths. Normalization is not the default behavior. I will close thbe PR until it has been decided that this change should be done. Sorry.

@picnixz picnixz closed this Jan 10, 2026
@picnixz picnixz reopened this Jan 12, 2026
@0xd6cb6d73

0xd6cb6d73 commented Jan 13, 2026 •

Copy link
Copy Markdown
Contributor Author

Ended up fixing the issue in extractall and not _get_extract_tarinfo as discussed in the issue because that ended up impacting the internal representation of tar objects in a way that broke a lot of tests. I think it's enough because the crash only shows up when calling lstat, which extract doesn't do, and _extract_member already perform the same separator conversion before writing to disk.

@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label May 4, 2026
@victorvianna

Copy link
Copy Markdown

Chromium just ran into this issue. Is this PR still being pursued?

@ethanfurman
ethanfurman merged commit 562f08d into python:main Nov 19, 2026
4 checks passed
@bedevere-bot

Copy link
Copy Markdown

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot RISC-V 64-bit Ubuntu Clang 3.x (tier-3) has failed when building commit 562f08d.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/2255/builds/787) and take a look at the build logs.
  4. Check if the failure is related to this commit (562f08d) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/2255/builds/787

Failed tests:

  • test_generator_stop

Summary of the results of the build (if available):

==

Click to see traceback logs
fatal: SHA1 COLLISION FOUND WITH 02d37d5dd2cefced3e2d834d453d6a5c848a2b9e !
fatal: fetch-pack: invalid index-pack output
fatal: SHA1 COLLISION FOUND WITH 02d37d5dd2cefced3e2d834d453d6a5c848a2b9e !
fatal: fetch-pack: invalid index-pack output
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
warning: The last gc run reported the following. Please correct the root cause
and remove .git/gc.log
Automatic cleanup will not be performed until the file is removed.

rror: bad packed object CRC for 02d26c4bef3ad0f9c97e47993a7fa67898842e5c
rror: bad packed object CRC for 02d26c4bef3ad0f9c97e47993a7fa67898842e5c
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
fatal: unable to read 02d26c4bef3ad0f9c97e47993a7fa67898842e5c
fatal: could not finish pack-objects to repack promisor objects
fatal: failed to run repack

remote: Enumerating objects: 13, done.        
remote: Counting objects:   7% (1/13)        
remote: Counting objects:  15% (2/13)        
remote: Counting objects:  23% (3/13)        
remote: Counting objects:  30% (4/13)        
remote: Counting objects:  38% (5/13)        
remote: Counting objects:  46% (6/13)        
remote: Counting objects:  53% (7/13)        
remote: Counting objects:  61% (8/13)        
remote: Counting objects:  69% (9/13)        
remote: Counting objects:  76% (10/13)        
remote: Counting objects:  84% (11/13)        
remote: Counting objects:  92% (12/13)        
remote: Counting objects: 100% (13/13)        
remote: Counting objects: 100% (13/13), done.        
remote: Compressing objects:  14% (1/7)        
remote: Compressing objects:  28% (2/7)        
remote: Compressing objects:  42% (3/7)        
remote: Compressing objects:  57% (4/7)        
remote: Compressing objects:  71% (5/7)        
remote: Compressing objects:  85% (6/7)        
remote: Compressing objects: 100% (7/7)        
remote: Compressing objects: 100% (7/7), done.        
remote: Total 7 (delta 6), reused 0 (delta 0), pack-reused 0 (from 0)        
Receiving objects:  14% (1/7)
Receiving objects:  28% (2/7)
Receiving objects:  42% (3/7)
Receiving objects:  57% (4/7)
Receiving objects:  71% (5/7)
Receiving objects:  85% (6/7)
Receiving objects: 100% (7/7)
Receiving objects: 100% (7/7), 1.35 KiB | 81.00 KiB/s, done.
Resolving deltas:   0% (0/6)
Resolving deltas:  16% (1/6)
Resolving deltas:  33% (2/6)
Resolving deltas:  50% (3/6)
Resolving deltas:  66% (4/6)
Resolving deltas:  83% (5/6)
Resolving deltas: 100% (6/6)
Resolving deltas: 100% (6/6), completed with 6 local objects.
From https://github.com/python/cpython
 * branch                  main       -> FETCH_HEAD
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
warning: The last gc run reported the following. Please correct the root cause
and remove .git/gc.log
Automatic cleanup will not be performed until the file is removed.

rror: bad packed object CRC for 02d26c4bef3ad0f9c97e47993a7fa67898842e5c
rror: bad packed object CRC for 02d26c4bef3ad0f9c97e47993a7fa67898842e5c
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
fatal: unable to read 02d26c4bef3ad0f9c97e47993a7fa67898842e5c
fatal: could not finish pack-objects to repack promisor objects
fatal: failed to run repack

Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
warning: The last gc run reported the following. Please correct the root cause
and remove .git/gc.log
Automatic cleanup will not be performed until the file is removed.

rror: bad packed object CRC for 02d26c4bef3ad0f9c97e47993a7fa67898842e5c
rror: bad packed object CRC for 02d26c4bef3ad0f9c97e47993a7fa67898842e5c
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
fatal: unable to read 02d26c4bef3ad0f9c97e47993a7fa67898842e5c
fatal: could not finish pack-objects to repack promisor objects
fatal: failed to run repack

Note: switching to '562f08d6910f01e98f90e589ca5ee065fcbae53e'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 562f08d691 gh-143663: Perform path normalization in TarFile.extractall() (GH-143665)
Switched to and reset branch 'main'

configure: WARNING: no system libmpdec found; falling back to pure-Python version for the decimal module

Kill <WorkerThread #2 running test=test_external_inspection pid=2245389 time=12.5 sec> process group
Kill <WorkerThread #3 running test=test.test_concurrent_futures.test_process_pool pid=2244538 time=1 min 7 sec> process group
Kill <WorkerThread #4 running test=test_unparse pid=2245403 time=12.1 sec> process group
make: *** [Makefile:2564: buildbottest] Error 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale Stale PR or inactive for long period of time.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants