Eryk Sun <eryk...@gmail.com> added the comment:

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

----------
resolution:  -> not a bug
stage: needs patch -> resolved
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue4198>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to