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 CarK, SilentGhost, eryksun, paul.moore, steve.dower, tim.golden, zach.ware
Date 2019-07-06.19:27:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1562441230.07.0.674783002952.issue37515@roundup.psfhosted.org>
In-reply-to
Content
DOS device names are reserved in the final component of DOS drive-letter paths. "AUX" (plus an optional colon, spaces, or extension) becomes "\\.\AUX", which is "\??\AUX" in the NT object namespace. By default, "\??\AUX" is a link to "\??\COM1", which, if it exists, is typically a link to "\Device\Serial0". If there's no "COM1", then the kernel returns STATUS_OBJECT_NAME_NOT_FOUND, which the Windows API translates to ERROR_FILE_NOT_FOUND, which the C runtime translates to ENOENT, and finally Python raises FileNotFoundError.

Accessing a DOS device name requires using a device path (prefixed by "\\.\" or "\\?\", and forward slash is okay, e.g. "//./C:/Temp/aux.py") or a UNC path (e.g. "//localhost/C$/Temp/aux.py"). That said, if we create a file like this, programs that use regular drive-letter paths won't be able to access it. It's better to sanitize reserved DOS device names. This includes "CONIN$" and "CONOUT$", even though Microsoft's documentation overlooks these two.
History
Date User Action Args
2019-07-06 19:27:10eryksunsetrecipients: + eryksun, paul.moore, tim.golden, SilentGhost, zach.ware, steve.dower, CarK
2019-07-06 19:27:10eryksunsetmessageid: <1562441230.07.0.674783002952.issue37515@roundup.psfhosted.org>
2019-07-06 19:27:10eryksunlinkissue37515 messages
2019-07-06 19:27:09eryksuncreate