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 dawidjoubert, eryksun, ezio.melotti, mark, steve.dower, tim.golden, valhallasw, zach.ware
Date 2021-03-21.05:20:31
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1616304032.34.0.391595643043.issue4198@roundup.psfhosted.org>
In-reply-to
Content
Filesystem paths in Windows are normally opened case insensitive, but a filesystem can choose to ignore this. NTFS does so for directories that flagged as case sensitive [1]. ntpath.normcase() doesn't incorporate this information. It would have to query the case-sensitive information for each component in the path. Instead it just assumes that all path components are case insensitive. That said, the way it does this does not correspond to how Windows filesystems implement case-insensitive comparisons. See bpo-42658. If supporting case-sensitive directories is needed, it should be addressed in that issue.

> same = os.path.samefile(f, f)
> print(same) # expected True; got False

I just followed up on investigating this. Apparently the VirtualBox "VBoxSharedFolderFS" filesystem generates a different file reference number randomly on each access. This violates the requirements for FileInternalInformation as specified in [MS-FSCC][2]. If file reference numbers aren't supported, the filesystem is supposed to return 0. That said, Python's samefile() doesn't currently follow the spec either. It blindly uses the st_dev (volume serial number) and st_ino (file reference number) values even when they're 0. See bpo-33935.

---

[1] https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/ntifs/ns-ntifs-_file_case_sensitive_information
[2] https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/7d796611-2fa5-41ac-8178-b6fea3a017b3
History
Date User Action Args
2021-03-21 05:20:32eryksunsetrecipients: + eryksun, tim.golden, mark, ezio.melotti, dawidjoubert, valhallasw, zach.ware, steve.dower
2021-03-21 05:20:32eryksunsetmessageid: <1616304032.34.0.391595643043.issue4198@roundup.psfhosted.org>
2021-03-21 05:20:32eryksunlinkissue4198 messages
2021-03-21 05:20:31eryksuncreate