Skip to content

[3.13] gh-160506: Fix ntpath.realpath() for broken links via directory links (GH-160507) - #161028

Open
miss-islington wants to merge 4 commits into
python:3.13from
miss-islington:backport-65665a4-3.13
Open

miss-islington wants to merge 4 commits into
python:3.13from
miss-islington:backport-65665a4-3.13

Conversation

@miss-islington

@miss-islington miss-islington commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Resolve the directory containing a broken relative symlink before
joining the link target to it, so that '..' in the target is applied
to the real directory.

ANT-2026-27II3A20
(cherry picked from commit 65665a4)

Co-authored-by: Gregory P. Smith 68491+gpshead@users.noreply.github.com

… links (pythonGH-160507)

Resolve the directory containing a broken relative symlink before
joining the link target to it, so that '..' in the target is applied
to the real directory.

ANT-2026-27II3A20
(cherry picked from commit 65665a4)

Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
@gpshead gpshead closed this Nov 9, 2026
@gpshead gpshead reopened this Nov 9, 2026
@github-project-automation github-project-automation Bot moved this from Todo to Done in Sprint Nov 9, 2026
@github-project-automation github-project-automation Bot moved this from Done to In Progress in Release and Deferred blockers 🚫 Nov 9, 2026
@github-project-automation github-project-automation Bot moved this from Done to In Progress in Sprint Nov 9, 2026
Before 3.15, tarfile keeps the '/' in symlink targets on Windows
(pythongh-57911), so writing through the '../evil' link fails, as already
handled in test_parent_symlink2.
Before 3.15, tarfile keeps the '/' in symlink targets on Windows
(pythongh-57911), so the links it creates cannot be followed and realpath()
fails on them.  test_ntpath covers the fix on Windows.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: In Progress
Status: In Progress

Development

Successfully merging this pull request may close these issues.

3 participants