Author eryksun
Recipients eryksun, jainankur, lazka, paul.moore, steve.dower, tim.golden, zach.ware
Date 2019-12-06.01:19:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1575595184.72.0.918259335713.issue38948@roundup.psfhosted.org>
In-reply-to
Content
> So essentially, you say the check should always be "ntpath.isdir(d) 

I forgot that ntpath.isdir is now genericpath.isdir, so that will work. The old nt._isdir wouldn't work because it was equivalent to an lstat. Apparently a vestigial import of nt._isdir remains in ntpath.py, even though nt._isdir was removed:

Lib/ntpath.py#l677">https://hg.python.org/cpython/file/v3.Lib/ntpath.py#l677

> On the other hand, this will make ntpath.ismount meaningless on POSIX, 
> as it will always require real access to the file system. Is it worth 
> having a "pure" implementation for best effort in this case? 

I'm not suggesting an existence check in POSIX. Whoever uses ntpath in POSIX must be aware that ntpath.ismount is useless for detecting Unix mount points. It's only useful for identifying potential mount points in a pure Windows path. I see no reason to break this use case.

For POSIX, I'd like ntpath._abspath_fallback to handle drive-relative paths, so we can fix the check in ismount to use `rest and rest in seps`. It seems wrong for _abspath_fallback("F:") to return the relative path "F:". No drives exist in POSIX, so it's harmless to assume that the working directory on each drive is the root directory, which is the default value in Windows anyway.

> Based on the splitdrive() 

Note that splitdrive currently doesn't support "UNC" device paths (issue 37609). For example, "//?/UNC/server/share" splits as ("//?/UNC", "/server/share"). "GLOBAL" device paths also aren't supported, which I'd prefer, but it's less important because they're only useful rarely, and I don't know of an existing path library that handles them. splitdrive also doesn't support repeated separators between the server and share components, such as "//server///share", which GetFullPathNameW handles nowadays. Maybe it didn't circa NT 5.0. The only place that's strict is the UNC root, which must be exactly two separators. I uploaded an implementation to issue 37609 that supports "UNC" and "GLOBAL" device paths, with support for repeated separators. Here's a complex example split: ("//?///Global///UNC///server///share", "///path").

Anyway, ntpath.ismount needs to distinguish between UNC and "UNC" device paths vs all other device paths, because a root path is only optional in the UNC case. For example, "//?/C:" or "//?/BootPartition" is a volume device, and "//?C:/" or "//?/BootPartition/" is a filesystem mount point. In Windows we can detect that "//?/C:" or "//?/BootPartition" isn't a directory, but in POSIX we need to get it right as a pure path.
History
Date User Action Args
2019-12-06 01:19:45eryksunsetrecipients: + eryksun, paul.moore, tim.golden, zach.ware, steve.dower, lazka, jainankur
2019-12-06 01:19:44eryksunsetmessageid: <1575595184.72.0.918259335713.issue38948@roundup.psfhosted.org>
2019-12-06 01:19:44eryksunlinkissue38948 messages
2019-12-06 01:19:43eryksuncreate