From: Daira Hopwood Date: Mon, 14 Sep 2015 17:21:09 +0000 (+0100) Subject: Compare size and ctime as well as mtime. X-Git-Url: https://git.rkrishnan.org/%5B/frontends/flags//%22%22.?a=commitdiff_plain;h=04fd39e8ffb7c74c89ebfd29a9cf2ad3c0c4ff5f;p=tahoe-lafs%2Ftahoe-lafs.git Compare size and ctime as well as mtime. Signed-off-by: Daira Hopwood --- diff --git a/src/allmydata/backupdb.py b/src/allmydata/backupdb.py index 9e8b5273..e6f723ae 100644 --- a/src/allmydata/backupdb.py +++ b/src/allmydata/backupdb.py @@ -418,7 +418,8 @@ class MagicFolderDB(BackupDB): def is_new_file_time(self, path, relpath_u): """recent_file_time returns true if the file is recent... - meaning it's current mtime matched the mtime that was previously stored in the db. + meaning its current statinfo (i.e. size, ctime, and mtime) matched the statinfo + that was previously stored in the db. """ print "check_file_time %s %s" % (path, relpath_u) path = abspath_expanduser_unicode(path) @@ -426,7 +427,6 @@ class MagicFolderDB(BackupDB): size = s[stat.ST_SIZE] ctime = s[stat.ST_CTIME] mtime = s[stat.ST_MTIME] - now = time.time() c = self.cursor c.execute("SELECT size,mtime,ctime,fileid" " FROM local_files" @@ -436,7 +436,7 @@ class MagicFolderDB(BackupDB): if not row: return True (last_size,last_mtime,last_ctime,last_fileid) = row - if int(mtime) == int(last_mtime): + if (size, ctime, mtime) == (last_size, last_ctime, last_mtime): return False else: return True