From 949fdf3002638acb334dbf1e128020bcf3b7a78e Mon Sep 17 00:00:00 2001
From: Daira Hopwood <daira@jacaranda.org>
Date: Mon, 14 Sep 2015 18:21:09 +0100
Subject: [PATCH] Compare size and ctime as well as mtime.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
---
 src/allmydata/backupdb.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

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
-- 
2.45.2