Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
Closed
Labels
Description
os.path.realpath(symblic link to DOS Device Paths) returns a path without \\?\ prefix even if patch that fix.
For example, there is below symlinks on C:\test.
C:\test>dir 03/05/2023 06:16 AM <SYMLINKD> media [\\?\ContainerMappedDirectories\CE94A662-0837-4F45-B403-55B3E57CE848] 03/05/2023 06:19 AM <SYMLINKD> to_c [\\?\C:\] Then exexute python and call os.path.realpath and call some functions to inspect.
>>>importos>>>fromntpathimportnormpath, normcase, devnull, join, isabs, _getfinalpathname, _getfinalpathname_nonstrict>>>>>>to_c_fn=r'to_c'>>>media_fn=r'media'>>>os.path.realpath(to_c_fn) 'C:\\'>>>os.path.realpath(media_fn) '\\ContainerMappedDirectories\\CE94A662-0837-4F45-B403-55B3E57CE848'>>>_getfinalpathname(to_c_fn) '\\\\?\\C:\\'>>>_getfinalpathname(media_fn) Traceback (mostrecentcalllast): File"<stdin>", line1, in<module>FileNotFoundError: [WinError2] Thesystemcannotfindthefilespecified: 'media'>>>_getfinalpathname_nonstrict(to_c_fn) '\\\\?\\C:\\'>>>_getfinalpathname_nonstrict(media_fn) '\\ContainerMappedDirectories\\CE94A662-0837-4F45-B403-55B3E57CE848'As the log indicates, os.path.realpath returns without a prefix.
I think it is wrong that _getfinalpathname_nonstrict removes DOS devices paths prefix.
So to fix the problem, I think we need to fix _getfinalpathname function on "Modules/posixmodule.c".
Please some opinions.