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 eryksun, laloch, paul.moore, steve.dower, tim.golden, zach.ware
Date 2020-04-09.15:19:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1586445587.88.0.252945434595.issue40238@roundup.psfhosted.org>
In-reply-to
Content
> os.stat() seems to be striping significant trailing spaces off 
> the path argument

The Windows file API normalizes paths to replace forward slashes with backslashes; resolve relative paths and "." and ".." components; strip trailing spaces and dots from the final component; and map reserved DOS device names in the final component of non-UNC paths to device paths (e.g. "C:/Temp/con " -> r"\\.\con").

Use a "\\?\" extended device path to bypass normalization, e.g. r"\\?\C:\Program Files     ". Because an extended path doesn't get normalized in an open or create context, it should only use backslash as the path separator and should be fully qualified, without any "." and ".." components. Also, a non-device UNC path has to explicitly use the "UNC" device, e.g. "//server/share/spam... " -> r"\\?\UNC\server\share\spam... ".

That said, I strongly advise against using an extended path to create or rename files to use reserved DOS device names or trailing dots and spaces. Such filenames will be inaccessible by most applications.
History
Date User Action Args
2020-04-09 15:19:47eryksunsetrecipients: + eryksun, paul.moore, tim.golden, zach.ware, steve.dower, laloch
2020-04-09 15:19:47eryksunsetmessageid: <1586445587.88.0.252945434595.issue40238@roundup.psfhosted.org>
2020-04-09 15:19:47eryksunlinkissue40238 messages
2020-04-09 15:19:47eryksuncreate