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

2021-03-20 Thread Eryk Sun
Change by Eryk Sun : -- components: +Extension Modules versions: +Python 3.10, Python 3.9 -Python 3.7 ___ Python tracker ___ ___ Pyt

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

2021-02-22 Thread Eryk Sun
Eryk Sun added the comment: On second thought, I think it's cleaner and avoids potential race conditions to implement ntpath.sameopenfile(). Then use that to implement ntpath.samefile(). Here's a summary of suggested changes, with sample code to flesh out the concepts: * Extend nt._getfinal

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

2021-02-17 Thread Alexander
Alexander added the comment: Hi, This issue was also confirmed by a Verge3D user (Python 3.7.7) https://www.soft8soft.com/topic/export-gltf-error -- nosy: +alexkowel ___ Python tracker __

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

2019-02-19 Thread Eryk Sun
Eryk Sun added the comment: > I don't see any value in testing the drive name separately. If the file number is non-zero, then the volume is the only question. I limited the comparison to just the drives in case the volume supports hardlinks. We can change the check to `s1.st_ino and s1.st_

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

2019-02-19 Thread Steve Dower
Steve Dower added the comment: Would it make sense to add a parameter to _getfinalpathname that specifies the type of the path? For same[open]file(), we can probably just go to the most unreadable but broadly supported type, whereas the other functions that are actually going to return the p

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

2019-02-18 Thread Eryk Sun
Eryk Sun added the comment: Here's a WebDAV example: net use Z: \\live.sysinternals.com\tools Both st_dev (volume serial number) and st_ino (file number) are 0 for all files on this drive. _getfinalpathname also fails since WebDAV doesn't support the default FILE_NAME_NORMALIZED flag (i

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

2019-02-17 Thread Giampaolo Rodola'
Giampaolo Rodola' 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

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

2019-02-17 Thread gary ruben
gary ruben added the comment: I wanted to add a datapoint to this. I also experience this problem in Windows but not with Google Drive File Stream. In my case it is also being triggered by Jupyter, which was where Deniz first noticed it, but I was saving the notebook to my Z: drive, which is

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

2018-07-11 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- type: crash -> behavior ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https

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

2018-06-25 Thread Giampaolo Rodola'
Change by Giampaolo Rodola' : -- nosy: +giampaolo.rodola ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http

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

2018-06-22 Thread Steve Dower
Steve Dower added the comment: For Windows it would be best (though slower) to pass the paths through os._getfinalpathname before comparison. Detecting that function is an easy way to get the platform right, too. Unfortunately, the MSDN docs don't make clear that the VSN can be modified, and

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

2018-06-21 Thread Deniz Bozyigit
Deniz Bozyigit added the comment: Hi, thank you for looking into this. I'm aware that the shown patch is not the ideal solution and a mere fix to get my jupyter operational. An indication on a workable solution could be the _samefile function in shutil that wraps os.path.samefile: def _sam

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

2018-06-21 Thread R. David Murray
R. David Murray added the comment: OK. Finding a solution for this (other than never raising samefile on such systems and documenting it as a limitation) may be difficult. -- ___ Python tracker ___

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

2018-06-21 Thread Eryk Sun
Eryk Sun added the comment: David, this is a bug in Python, and the proposed patch is insufficient. We use the volume serial number as st_dev, and this is not guaranteed to be unique in Windows, and may be 0, just as a file's index number is also allowed to be 0. Both possibilities are well

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

2018-06-21 Thread R. David Murray
R. David Murray added the comment: That patch would cause references to the same file on a google drive to report that the files were different. I'd say this is a bug in Google Drive's posix emulation. I'm not sure there's a good answer here, because even if every other element of the stat

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

2018-06-21 Thread Deniz Bozyigit
Change by Deniz Bozyigit : -- title: shutil.copyfile throws incorrect SameFileError -> shutil.copyfile throws incorrect SameFileError on Google Drive File Stream ___ Python tracker __

[issue33935] shutil.copyfile throws incorrect SameFileError

2018-06-21 Thread Deniz Bozyigit
New submission from Deniz Bozyigit : When using shutil.copyfile on the Google Drive File Stream file system, a incorrect SameFileError can occur. MWE (assuming foo.txt exists in your google drive G:\\): >>> f1 = 'G:\\My Drive\\foo.txt' >>> f2 = 'G:\\My Drive\\foo2.txt' >>> import shutil >>> s