From c77c52f8e665f95b8fff0cc437d3d8b7df6a19bd Mon Sep 17 00:00:00 2001 From: meejah Date: Mon, 26 Oct 2015 08:05:19 -0600 Subject: [PATCH] daira's fix instead of deleted_files, and .backup not .tmp --- src/allmydata/frontends/magic_folder.py | 13 +------------ src/allmydata/magicfolderdb.py | 2 ++ 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/allmydata/frontends/magic_folder.py b/src/allmydata/frontends/magic_folder.py index 8816ccb5..2121356a 100644 --- a/src/allmydata/frontends/magic_folder.py +++ b/src/allmydata/frontends/magic_folder.py @@ -64,8 +64,6 @@ class MagicFolder(service.MultiService): self.uploader = Uploader(client, local_path_u, db, upload_dircap, pending_delay, clock) self.downloader = Downloader(client, local_path_u, db, collective_dircap, clock) - # FIXME FIXME FIXME horrible, just trying it out - self.downloader._deleted_files = self.uploader._deleted_files def startService(self): # TODO: why is this being called more than once? @@ -207,14 +205,6 @@ class Uploader(QueueMixin): self._notifier.watch(self._local_filepath, mask=self.mask, callbacks=[self._notify], recursive=True) - # we keep a list of files we've "recently" deleted, as we'll - # get inotify events for these, but we want to ignore - # them. (e.g. if we just decided we need to delete a file - # locally, we don't want to immediately upload a new "deleted" - # version of it) - self._deleted_files = [] - - def start_monitoring(self): self._log("start_monitoring") d = defer.succeed(None) @@ -688,8 +678,7 @@ class Downloader(QueueMixin, WriteFileMixin): def _unlink_deleted_file(self, abspath_u, result): try: self._log('unlinking: %s' % (abspath_u,)) - self._deleted_files.append(abspath_u) - shutil.move(abspath_u, abspath_u + '.tmp') + shutil.move(abspath_u, abspath_u + '.backup') except IOError: self._log("Already gone: '%s'" % (abspath_u,)) return abspath_u diff --git a/src/allmydata/magicfolderdb.py b/src/allmydata/magicfolderdb.py index ba338138..0c76a7b0 100644 --- a/src/allmydata/magicfolderdb.py +++ b/src/allmydata/magicfolderdb.py @@ -135,4 +135,6 @@ class MagicFolderDB(object): row = self.cursor.fetchone() if not row: return True + if not pathinfo.exists and row[0] is None: + return False return (pathinfo.size, pathinfo.mtime, pathinfo.ctime) != row -- 2.45.2