[issue33898] pathlib issues with Windows device paths

2020-04-17 Thread Antoine Pitrou


Change by Antoine Pitrou :


--
versions: +Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33898] pathlib issues with Windows device paths

2019-03-07 Thread Steve Dower


Steve Dower  added the comment:

Eryk - I've got the PR ready as far as I'm concerned. Have you had a look to 
see if you're happy with its logic for these cases?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33898] pathlib issues with Windows device paths

2019-02-16 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
versions:  -Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33898] pathlib issues with Windows device paths

2018-08-04 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
pull_requests: +8163
stage: test needed -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33898] pathlib issues with Windows device paths

2018-06-19 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +pitrou

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33898] pathlib issues with Windows device paths

2018-06-18 Thread Eryk Sun


New submission from Eryk Sun :

For \\?\ extended device paths, pathlib removes the trailing slash for the root 
directory if the device isn't UNC or a logical (A-Z) drive.

Correct:

>>> str(Path('//?/UNC/'))
'?\\UNC\\'

>>> str(Path('//?/Z:/'))
'?\\Z:\\'

Incorrect:

>>> str(Path('//?/BootPartition/'))
'?\\BootPartition'

>>> str(Path('//?/Volume{}/'))
'?\\Volume{}'

>>> str(Path('//?/Global/Z:/'))
'?\\Global\\Z:'

It keeps the trailing slash for some \\.\ paths, but not all.

Correct:

>>> str(Path('//./BootPartition/'))
'.\\BootPartition\\'

Incorrect:

>>> str(Path('//./Global/Z:/'))
'.\\Global\\Z:'

It adds a root directory to \\.\ device paths where none was specified. 

Incorrect:

>>> str(Path('//./nul'))
'.\\nul\\'

>>> str(Path('//./PhysicalDrive0'))
'.\\PhysicalDrive0\\'

>>> str(Path('//./C:'))
'.\\C:\\'

".\\C:" refers to the volume device, whereas ".\\C:\\" is the root 
directory in the file system.

pathlib should parse \\?\ and \\.\ device paths the same way with respect to 
the drive and root. The difference in practice is only how Windows does (\\.\) 
or does not (\\?\) canonicalize the path. 

Additionally, pathlib fails to identify the drive correctly in these cases.

Incorrect:

>>> Path('//?/Global/Z:/').drive
'?\\'

>>> Path('//?/BootPartition/Temp').drive
'?\\'

Except for "UNC" and "Global" paths, the drive should be the first component 
after the local-device prefix. The "UNC" device also includes subsequent server 
and share components, if any. For the reserved "Global" symlink, it should look 
to the next component. For example, r'\\?\Global\UNC\server\share' is a drive. 

There's also the "GlobalRoot" symlink (or "Global\\GlobalRoot" to be pedantic), 
but that can't be handled generically.

--
components: Library (Lib), Windows
messages: 319921
nosy: eryksun, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
stage: test needed
status: open
title: pathlib issues with Windows device paths
type: behavior
versions: Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com