Message413307
shutil.copy fails to copy a file from a shadow copy back to its original file since os.path.samefile returns True. os.path.samefile doesn't reliably detect these files are different since it relies on ino which is the same for both files
>>> sc = pathlib.Path('//?/GLOBALROOT/Device/HarddiskVolumeShadowCopy3/test.file')
>>> o = pathlib.Path("V:/test.file")
>>> os.path.samefile(sc, o)
True
>>> os.stat(sc)
os.stat_result(st_mode=33206, st_ino=3458764513820579328, st_dev=1792739134, st_nlink=1, st_uid=0, st_gid=0, st_size=1, st_atime=1644973968, st_mtime=1644974052, st_ctime=1644973968)
>>> os.stat(o)
os.stat_result(st_mode=33206, st_ino=3458764513820579328, st_dev=1792739134, st_nlink=1, st_uid=0, st_gid=0, st_size=2, st_atime=1644973968, st_mtime=1644974300, st_ctime=1644973968)
>>> open(sc, "r").read()
'1'
>>> open(o, "r").read()
'12'
In the above example, you can see the shadow copy file and the original file. Their mode and ino are the same, but their modified time and contents are different |
|
Date |
User |
Action |
Args |
2022-02-16 01:45:13 | nijave | set | recipients:
+ nijave, paul.moore, tim.golden, zach.ware, steve.dower |
2022-02-16 01:45:13 | nijave | set | messageid: <1644975913.58.0.577499491465.issue46763@roundup.psfhosted.org> |
2022-02-16 01:45:13 | nijave | link | issue46763 messages |
2022-02-16 01:45:13 | nijave | create | |
|