[issue33935] shutil.copyfile throws incorrect SameFileError on Google Drive File Stream

Giampaolo Rodola' report at bugs.python.org
Sun Feb 17 06:51:01 EST 2019


Giampaolo Rodola' <g.rodola at gmail.com> added the comment:

@eryksun

> Using the VSN and file index as if they're the same as POSIX st_dev and st_ino is technically wrong. There is no guarantee that this tuple uniquely identifies a file in Windows.

I agree. FWIW, I faced the same issue on pyftpdlib and ended up not supporting Windows: 
https://github.com/giampaolo/pyftpdlib/blob/eef8a5650cd611da1df5fce16974ce90f43f4dc0/pyftpdlib/filesystems.py#L596-L605
It seems to me the problem here is os.path.samefile():
 https://github.com/python/cpython/blob/0185f34ddcf07b78feb6ac666fbfd4615d26b028/Lib/genericpath.py#L87-L98

@steve.dower
> For Windows it would be best (though slower) to pass the paths through os._getfinalpathname before comparison.

It seems this is how samefile() was originally implemented but it was changed:
https://github.com/python/cpython/commit/490b32a3976d84eaf1d6ca8cdcb00eac0ce5055b
https://bugs.python.org/issue11939

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33935>
_______________________________________


More information about the Python-bugs-list mailing list