Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
gh-96290: support partial/invalid UNC drives in normpath() and splitdrive()#100351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
barneygale commented Dec 19, 2022 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
471c47b to 7ab642bCompare…splitdrive() This brings the Python implementation of `ntpath.normpath()` in line with the C implementation added in 99fcf15 Co-authored-by: Eryk Sun <eryksun@gmail.com>
7ab642b to 1fb70c7Compareeryksun commented Dec 22, 2022
Almost. The C implementation is incorrect for "UNC" device paths. For example: >>> nt._path_normpath('//?/UNC/server/share/..') '\\\\?\\UNC\\server'The problem is that it handles "//?/UNC/" as the root instead of "//?/UNC/server/share/". The pure Python implementation gets it right. |
barneygale commented Dec 22, 2022
I've changed "in line" to "more in line" :-) |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Eryk Sun <eryksun@gmail.com>
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Eryk Sun <eryksun@gmail.com>
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Eryk Sun <eryksun@gmail.com>
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Eryk Sun <eryksun@gmail.com>
Uh oh!
There was an error while loading. Please reload this page.
zooba commented Jan 11, 2023
If Eryk and Barney both say this is ready, I'm happy to merge. |
barneygale commented Jan 12, 2023
It's ready to land I think! |
eryksun commented Jan 12, 2023 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
A long-standing issue with tester('ntpath.isabs("\\\\conky\\mountpoint")', 1) tester('ntpath.isabs("\\\\.\\C:")', 1) |
eryksun commented Jan 12, 2023
@zooba, it's ready to be merged. |
miss-islington commented Jan 12, 2023
Thanks @barneygale for the PR, and @zooba for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11. |
miss-islington commented Jan 12, 2023
Sorry, @barneygale and @zooba, I could not cleanly backport this to |
bedevere-bot commented Jan 12, 2023
GH-100999 is a backport of this pull request to the 3.11 branch. |
…() and splitdrive() (pythonGH-100351) This brings the Python implementation of `ntpath.normpath()` in line with the C implementation added in 99fcf15 Co-authored-by: Eryk Sun <eryksun@gmail.com>
barneygale commented Jan 12, 2023
Thank you both! |
Fix handling of partial and invalid UNC drives in
ntpath.splitdrive(), and inntpath.normpath()on non-Windows systems.Paths such as
\\serverand\\are now considered bysplitdrive()to contain only a drive, and consequently are not modified bynormpath()on non-Windows systems. The behaviour ofnormpath()on Windows systems is unaffected, as native OS APIs are used.This brings the Python implementation of
ntpath.normpath()more in line with the C implementation added in 99fcf15.Implementation by @eryksun. I added tests and NEWS.