-
-
Notifications
You must be signed in to change notification settings - Fork 32k
[Windows] ntpath.realpath() of bytes root directory may raise TypeError in some cases #88013
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
Comments
some win7sp1 and win10:20H2 boxes cannot realpath a networked drive letter such as b"n:" (also affects b"n:\\")
requirements to trigger:
hits the following exceptions in succession:
|
In ntpath._getfinalpathname_nonstrict(), Currently To reproduce this issue, create a substitute drive for a directory that grants no access. For example: import os
os.mkdir('spam')
os.system('icacls spam /inheritance:r')
os.system('subst N: spam') >>> os.path.realpath(b'N:/')
Traceback (most recent call last):
File "C:\Program Files\Python39\lib\ntpath.py", line 647, in realpath
path = _getfinalpathname(path)
PermissionError: [WinError 5] Access is denied: b'N:\\'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\Python39\lib\ntpath.py", line 601, in _getfinalpathname_nonstrict
path = _getfinalpathname(path)
PermissionError: [WinError 5] Access is denied: b'N:\\'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Program Files\Python39\lib\ntpath.py", line 651, in realpath
path = _getfinalpathname_nonstrict(path)
File "C:\Program Files\Python39\lib\ntpath.py", line 621, in _getfinalpathname_nonstrict
return path + tail
TypeError: can't concat str to bytes |
There is another simple way to reproduce the bug, just call |
…pythonGH-102813) (cherry picked from commit 4dc339b) Co-authored-by: AN Long <[email protected]>
GH-102813, GH-103343) (cherry picked from commit 4dc339b) Co-authored-by: AN Long <[email protected]> Co-authored-by: Barney Gale <[email protected]>
Fixed in:
Thanks for the fix, @aisk! |
Uh oh!
There was an error while loading. Please reload this page.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
Linked PRs
The text was updated successfully, but these errors were encountered: