Repository navigation
Conversation
… links 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
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.
ntpath._readlink_deep(), the fallbackrealpath()uses for a link Windows cannot open, now resolves the directory that contains the link with_getfinalpathname()before joining a relative target to it, so..in the target goes up from the real directory. It keeps the textual join only if that directory cannot be resolved with one of the error codes the function already tolerates. Two expectations intest_realpath_broken_symlinkschange (broken2andbroken3now resolve toABSTFN\missing), because they asserted the unresolved join.I could not run this on Windows: the changed branch and the
test_ntpathtests are skipped on Linux, where I only exercised the code over stand-ins for thentfunctions. It needs the Windows CI run before review.test_parent_symlink3intest_tarfilepasses on Linux with and without the change; its Windows branch is the one that depends on it.Fixes #160506
ANT-2026-27II3A20
os.path.realpath()on Windows misresolves a broken symlink reached through a directory symlink #160506