GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — bpo-38453: Ensure ntpath.realpath correctly resolves relative paths by zooba · Pull Request #16967 · python/cpython

Conversation

@zooba

@zooba zooba commented Oct 28, 2019 •
edited by bedevere-bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

https://bugs.python.org/issue38453

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@zooba
bpo-38453: Ensure ntpath.realpath correctly resolves relative paths
58896d2
@zooba zooba added type-bug An unexpected behavior, bug, or error OS-windows needs backport to 3.8 labels Oct 28, 2019
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Oct 28, 2019
@bedevere-bot bedevere-bot added the awaiting core review label Oct 28, 2019
@zooba
Ensure isabs() is always True for \\?\ prefixed paths
ed45d40
@zooba

zooba commented Oct 28, 2019

Copy link
Copy Markdown
Member Author

@eryksun Would love your input on this one if you get a chance.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

eryksun
eryksun reviewed Oct 28, 2019
View reviewed changes
Comment thread Lib/ntpath.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

zooba added 2 commits November 12, 2019 14:38
@zooba
Avoid unnecessary usage of readlink()
c7213c9
@zooba
Limit readlink to paths we can reliably interpret. Update tests to re…
2a33283
…flect simplified resolution.
@zooba

zooba commented Nov 13, 2019

Copy link
Copy Markdown
Member Author

Okay, the latest push changes how we handle relative symlink targets. Only things reporting islink will be resolved if they're relative paths, otherwise we just don't traverse the mount point (unless the OS successfully did it, in which case this entire code path never executes).

This will change the result for broken links, as we can see in the test updates. It shouldn't affect links that exist, other than fixing the relative path issues we were seeing that were the cause of the bug in the first place (the new join(cwd, path) in realpath).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

zooba added 2 commits November 13, 2019 10:04
@zooba
Ensure shutil tests run in test directory
8232a04
@zooba
Fix test_shutil on Linux
abac3e5
@zooba
zooba merged commit abde52c into python:master Nov 15, 2019
@zooba
zooba deleted the bpo-38453 branch November 15, 2019 17:49
@miss-islington

miss-islington commented Nov 15, 2019

Copy link
Copy Markdown
Contributor

Thanks @zooba for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒⛏🤖

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot removed the awaiting core review label Nov 15, 2019
@miss-islington

miss-islington commented Nov 15, 2019

Copy link
Copy Markdown
Contributor

Sorry, @zooba, I could not cleanly backport this to 3.8 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker abde52cd8e31830bfc06c5803221faae6172104a 3.8

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@miss-islington miss-islington assigned zooba Nov 15, 2019
@zooba zooba added needs backport to 3.8 and removed needs backport to 3.8 labels Nov 15, 2019
@miss-islington

miss-islington commented Nov 15, 2019

Copy link
Copy Markdown
Contributor

Thanks @zooba for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒⛏🤖

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@miss-islington

miss-islington commented Nov 15, 2019

Copy link
Copy Markdown
Contributor

Sorry @zooba, I had trouble checking out the 3.8 backport branch.
Please backport using cherry_picker on command line.
cherry_picker abde52cd8e31830bfc06c5803221faae6172104a 3.8

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@zooba zooba added needs backport to 3.8 and removed needs backport to 3.8 labels Nov 15, 2019
@miss-islington

miss-islington commented Nov 15, 2019

Copy link
Copy Markdown
Contributor

Thanks @zooba for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@miss-islington

miss-islington commented Nov 15, 2019

Copy link
Copy Markdown
Contributor

Sorry, @zooba, I could not cleanly backport this to 3.8 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker abde52cd8e31830bfc06c5803221faae6172104a 3.8

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

zooba added a commit to zooba/cpython that referenced this pull request Nov 15, 2019
@zooba
bpo-38453: Ensure ntpath.realpath correctly resolves relative paths (p…
0049b22
…ythonGH-16967)

Ensure isabs() is always True for \\?\ prefixed paths
Avoid unnecessary usage of readlink() to avoid resolving broken links incorrectly
Ensure shutil tests run in test directory
@bedevere-bot

bedevere-bot commented Nov 15, 2019

Copy link
Copy Markdown

GH-17174 is a backport of this pull request to the 3.8 branch.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot removed the needs backport to 3.8 label Nov 15, 2019
zooba added a commit that referenced this pull request Nov 15, 2019
@zooba
bpo-38453: Ensure ntpath.realpath correctly resolves relative paths (G…
66c0f01
…H-16967)

Ensure isabs() is always True for \\?\ prefixed paths
Avoid unnecessary usage of readlink() to avoid resolving broken links incorrectly
Ensure shutil tests run in test directory
jacobneiltaylor pushed a commit to jacobneiltaylor/cpython that referenced this pull request Dec 5, 2019
@zooba Jake Taylor
bpo-38453: Ensure ntpath.realpath correctly resolves relative paths (p…
3810001
…ythonGH-16967)

Ensure isabs() is always True for \\?\ prefixed paths
Avoid unnecessary usage of readlink() to avoid resolving broken links incorrectly
Ensure shutil tests run in test directory
shihai1991 pushed a commit to shihai1991/cpython that referenced this pull request Jan 31, 2020
@zooba @shihai1991
bpo-38453: Ensure ntpath.realpath correctly resolves relative paths (p…
40dd5e4
…ythonGH-16967)

Ensure isabs() is always True for \\?\ prefixed paths
Avoid unnecessary usage of readlink() to avoid resolving broken links incorrectly
Ensure shutil tests run in test directory
@gpshead gpshead mentioned this pull request Oct 23, 2026
os.path.realpath() on Windows misresolves a broken symlink reached through a directory symlink #160506
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@eryksun eryksun eryksun left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@zooba zooba

Labels

OS-windows type-bug An unexpected behavior, bug, or error

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@zooba @miss-islington @bedevere-bot @eryksun @the-knights-who-say-ni
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.