This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eryksun
Recipients apple502j, belopolsky, eryksun, p-ganssle, paul.moore, steve.dower, tim.golden, zach.ware
Date 2021-08-04.17:32:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1628098365.28.0.673071443937.issue44829@roundup.psfhosted.org>
In-reply-to
Content
In zoneinfo._tzpath, _validate_tzfile_path() depends on os.path.normpath(). I think the Windows implementation of normpath() in the ntpath module should be extended to normalize reserved names in the final path component in the same manner as WinAPI GetFullPathNameW(). 

Alternatively, an isreserved() function could be added to os.path. This would allow _validate_tzfile_path() to raise a more informative exception for a reserved name.

Reserved names:

GetFullPathNameW() strips trailing spaces and dots from the final path component. This applies to all path types. For example:

    >>> nt._getfullpathname('\\\\?\\UNC/server/share/spam. . .')
    '\\\\?\\UNC\\server\\share\\spam'

GetFullPathNameW() reserves DOS device names in the final component of a relative path or drive path -- but not in a UNC path or device path. The following case-insensitive names are reserved:

    * NUL
    * CON
    * CONIN$
    * CONOUT$
    * AUX
    * PRN
    * COM<1-9>
    * LPT<1-9>

A reserved device name begins with one of the above base names plus an optional suffix. The suffix is zero or more spaces followed optionally by a "." or ":" and zero or more characters. The normalized result is a "\\\\.\\" device path for the base device name. For example: 

    >>> nt._getfullpathname('C:/Temp/con . spam')
    '\\\\.\\con'
    >>> nt._getfullpathname('C:/Temp/con : spam')
    '\\\\.\\con'
History
Date User Action Args
2021-08-04 18:03:38eryksununlinkissue44829 messages
2021-08-04 17:32:45eryksunsetrecipients: + eryksun, paul.moore, belopolsky, tim.golden, zach.ware, steve.dower, p-ganssle, apple502j
2021-08-04 17:32:45eryksunsetmessageid: <1628098365.28.0.673071443937.issue44829@roundup.psfhosted.org>
2021-08-04 17:32:45eryksunlinkissue44829 messages
2021-08-04 17:32:45eryksuncreate
Morty Proxy This is a proxified and sanitized view of the page, visit original site.