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 Max Staff, eryksun, pitrou, r.david.murray, steven.daprano
Date 2017-06-13.06:09:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1497334182.1.0.945612638452.issue30641@psf.upfronthosting.co.za>
In-reply-to
Content
An exception specifically for ENAMETOOLONG would be limited to Unix systems.

The Windows CRT defines ENAMETOOLONG but doesn't use it. Windows file systems do not return a specific status code for a filename that's too long. Per MS-FSA 2.1.5.1 [1], a request to open a file must fail with STATUS_OBJECT_NAME_INVALID if the name is invalid according to the spec in MS-FSCC 2.1.5 [2] (e.g. max component length cannot exceed 255 characters and may be less). This doesn't tell the caller why the filename is invalid. Anyway, for what it's worth, the Windows API translates this status code to ERROR_INVALID_NAME (0x007B), and the CRT in turn maps the latter to EINVAL.

Also, for versions prior to Windows 10, or Windows 10 without the LongPathsEnabled policy setting, the observed error is more commonly due to path preprocessing in user mode. In this case DOS paths are limited to MAX_PATH (260). The error depends on the called function -- e.g. CreateFileA vs SetCurrentDirectoryA, or calling the [A]NSI vs [W]ide-character version. It could be ERROR_PATH_NOT_FOUND (ENOENT), ERROR_FILENAME_EXCED_RANGE (ENOENT), or ERROR_INVALID_PARAMETER (EINVAL). 

[1]: https://msdn.microsoft.com/en-us/library/ff469536
[2]: https://msdn.microsoft.com/en-us/library/cc422524
History
Date User Action Args
2017-06-13 06:09:42eryksunsetrecipients: + eryksun, pitrou, steven.daprano, r.david.murray, Max Staff
2017-06-13 06:09:42eryksunsetmessageid: <1497334182.1.0.945612638452.issue30641@psf.upfronthosting.co.za>
2017-06-13 06:09:42eryksunlinkissue30641 messages
2017-06-13 06:09:41eryksuncreate