From: Daira Hopwood <daira@jacaranda.org>
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/%5D%20/uri/flags/class-simplejson.JSONEncoder.html?a=commitdiff_plain;h=8fbec2a8f6b07bdd10b09f8ba185f37b3d8832d2;p=tahoe-lafs%2Ftahoe-lafs.git

Compare size and ctime as well as mtime.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
---

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