[issue42958] filecmp.cmp(shallow=True) isn't actually shallow when only mtime differs

Christof Hanke report at bugs.python.org
Mon Jul 12 18:30:15 EDT 2021


Christof Hanke <christof.hanke at mpcdf.mpg.de> added the comment:

Hi Andrei,

I would follow rsync. 
>From the man page:
"""
[...]
 -c, --checksum
              This changes the way rsync checks if the files have been changed and are in need of a transfer.   Without  this  option,  rsync
              uses  a  "quick  check" that (by default) checks if each file’s size and time of last modification match between the sender and
              receiver. 
[...]
"""

so, yes you can have false positives with a shallow comparison of size + mtime only. But that's usually ok for e.g. incremental backups. 


Wow, the bug is that old...

----------

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


More information about the Python-bugs-list mailing list