New submission from Eryk Sun:

os.path.samefile (used by shutil copyfile and move), os.path.sameopenfile, and 
pathlib.samefile rely on os.path.samestat (from genericpath.py), which compares 
corresponding st_dev and st_ino values. POSIX assures that the tuple (st_dev, 
st_ino) is unique. Windows makes no such assurance for the combination of the 
volume serial number (st_dev) and file index number (st_ino). The volume serial 
number isn't required to be unique or even non-zero ([MS-FSCC] 2.5.9), and the 
file index number may also be zero if the file system doesn't support it 
([MS-FSCC] 2.4.20).

[MS-FSCC]: File System Control Codes
https://msdn.microsoft.com/en-us/library/cc231987

A WebDAV network drive exemplifies both cases. The volume serial number is 
zero, as is the file index number for every file and directory. Thus samestat() 
is true for every comparison on the drive, whether for a file or directory, and 
also when comparing files mounted on different WebDAV drives.

This isn't a common problem, but I think it's severe enough to warrant a 
separate Windows implementation of samefile and sameopenfile. If the 
corresponding st_dev and st_ino values are equal and either is zero, it should 
compare the final paths via _getfinalpathname. The latter would need to be 
modified to support passing a file descriptor for use with sameopenfile.

----------
components: Windows
messages: 294538
nosy: eryksun, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
stage: test needed
status: open
title: samefile and sameopenfile fail for WebDAV mapped drives
type: behavior
versions: Python 3.5, Python 3.6, Python 3.7

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

Reply via email to