[issue22302] Windows os.path.isabs UNC path bug

2021-02-25 Thread Eryk Sun
Eryk Sun added the comment: > figure out whether to do `Path.cwd() / path` Thus a UNC path is absolute, i.e. any path that starts with 2 or more slashes, and all other paths are relative unless they have both a drive and a root. For example: def isabs(s): """Test whether a path

[issue22302] Windows os.path.isabs UNC path bug

2017-01-15 Thread Eryk Sun
Eryk Sun added the comment: isabs also fails for device paths such as r"\\.\C:", which is an absolute path for opening the C: volume. UNC and device paths (i.e. \\server, \\?, and \\.) should always be considered absolute. Only logical drives (i.e. C:, D:, etc) support drive-relative paths.

[issue22302] Windows os.path.isabs UNC path bug

2017-01-14 Thread Eryk Sun
Changes by Eryk Sun : -- Removed message: http://bugs.python.org/msg226094 ___ Python tracker ___

[issue22302] Windows os.path.isabs UNC path bug

2017-01-14 Thread Eryk Sun
Changes by Eryk Sun : -- stage: -> needs patch versions: +Python 3.6, Python 3.7 -Python 3.3, Python 3.4 ___ Python tracker ___

[issue22302] Windows os.path.isabs UNC path bug

2014-09-06 Thread Akima
Akima added the comment: I just realised that monkeyfart!££ is actually a valid relative path name. What I said still holds, just replace monkeyfart!££ with elephant*dung? (which contains the invalid characters: *? ). -- ___ Python tracker

[issue22302] Windows os.path.isabs UNC path bug

2014-09-06 Thread Akima
Akima added the comment: eryksun: You have marked this bug as effecting Python 2.7. When I tested for the bug on 2.7.5 the problem didn't show up: Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win32 Type help, copyright, credits or license for more information.

[issue22302] Windows os.path.isabs UNC path bug

2014-09-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This is the consequence of recent backporting splitdrive() implementation from 3.x to 2.7. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22302 ___

[issue22302] Windows os.path.isabs UNC path bug

2014-09-05 Thread Steve Dower
Steve Dower added the comment: Antoine almost certainly thought about this with pathlib and may know about the change, or at least have some decent context on it. I'm more inclined to think that os.path.isabs(r\\server) should also return False, since it's not a path that can be opened

[issue22302] Windows os.path.isabs UNC path bug

2014-09-05 Thread Antoine Pitrou
Antoine Pitrou added the comment: Under Windows, pathlib's absolute means a fully qualified path as defined in http://msdn.microsoft.com/en-us/library/aa365247%28v=vs.85%29.aspx PureWindowsPath(c:).is_absolute() False PureWindowsPath(/).is_absolute() False PureWindowsPath(c:/).is_absolute()

[issue22302] Windows os.path.isabs UNC path bug

2014-09-05 Thread Steve Dower
Steve Dower added the comment: My experience says the main reason people want to know whether the path is absolute is to figure out whether to do `Path.cwd() / path` or not. According to that MSDN page, they shouldn't because the path starts with // (that is, the last character and the

[issue22302] Windows os.path.isabs UNC path bug

2014-09-05 Thread Steve Dower
Steve Dower added the comment: Just did a double-take, but that output for Path('server\\').parts[0] is actually correct... Path('server\\').parts[0] 'server' print(Path('server\\').parts[0]) \\server\\ -- ___ Python tracker

[issue22302] Windows os.path.isabs UNC path bug

2014-09-05 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It looks to me that rather handling of //server/ is buggy than //server. //server is just the same as /server or ///server. But //server/ looks as an UNC path with empty () mount point. This is invalid path and we can't create valid path from this path by

[issue22302] Windows os.path.isabs UNC path bug

2014-09-05 Thread eryksun
eryksun added the comment: Isn't this bug about the root of a share case with ntpath.isabs in 3.x and 2.7 (splitdrive was backported)? For example: os.path.isabs(//server/share) False os.path.splitdrive('//server/share') ('//server/share', '') vs.

[issue22302] Windows os.path.isabs UNC path bug

2014-09-05 Thread Antoine Pitrou
Antoine Pitrou added the comment: Serhiy, you may be right. I'd suggest opening a python-dev discussion to gather more feedback. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22302 ___

[issue22302] Windows os.path.isabs UNC path bug

2014-09-05 Thread eryksun
eryksun added the comment: //server is just the same as /server or ///server. Repeated slashes aren't collapsed at the start of a Windows path. Here's what I get in Windows 7: os.listdir('/server') [] os.listdir('//server') Traceback (most recent call last): File

[issue22302] Windows os.path.isabs UNC path bug

2014-09-05 Thread Akima
Akima added the comment: As eryksun pointed out, I created this bug report to report on one issue; that \\server\share isn't being consider absolute by os.path.isabs when it should be considered absolute. I found this bug when I was writing a basic config file parsing module. One of the

[issue22302] Windows os.path.isabs UNC path bug

2014-09-01 Thread Akima
Akima added the comment: I checked for the existence of this bug in 2 other python versions today. It's present in CPython 3.4.1, but CPython 2.7.5 doesn't exhibit the issue. Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win32 Type help, copyright, credits or

[issue22302] Windows os.path.isabs UNC path bug

2014-08-30 Thread Akima
Akima added the comment: FYI: I've only tested this bug on Python 3.3.5 on Windows 7. I expect the bug exists in other versions of Python. -- type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22302

[issue22302] Windows os.path.isabs UNC path bug

2014-08-29 Thread Akima
New submission from Akima: A UNC path pointing to the root of a share is not being recognised as an absolute path when it should be. See this interpreter session. PythonWin 3.3.5 (v3.3.5:62cf4e77f785, Mar 9 2014, 10:35:05) [MSC v.1600 64 bit (AMD64)] on win32. Portions Copyright 1994-2008

[issue22302] Windows os.path.isabs UNC path bug

2014-08-29 Thread eryksun
eryksun added the comment: It's a relative path if the share name lacks a trailing slash. Consider the hidden share //server/C$ for the C: drive. C: is a relative path, while C:/ is an absolute path. Similarly //server/C$ is relative, while //server/C$/ is absolute. -- nosy: +eryksun

[issue22302] Windows os.path.isabs UNC path bug

2014-08-29 Thread eryksun
eryksun added the comment: On second thought, while the parallels between drives and shares are nice, beyond that this makes no sense to me. http://hg.python.org/cpython/file/c0e311e010fc/Lib/ntpath.py#l91 Windows uses hidden environment variables (e.g. =C:) for the working directory on each