From: meejah Date: Tue, 15 Dec 2015 16:02:58 +0000 (-0800) Subject: WIP and debugging things X-Git-Url: https://git.rkrishnan.org/vdrive/%5B/%5D%20/index.php?a=commitdiff_plain;h=bd568a589e1d2f7bd3c298ccbfe0cbdaca7ac075;p=tahoe-lafs%2Ftahoe-lafs.git WIP and debugging things --- diff --git a/src/allmydata/frontends/magic_folder.py b/src/allmydata/frontends/magic_folder.py index 353b8fac..224b6097 100644 --- a/src/allmydata/frontends/magic_folder.py +++ b/src/allmydata/frontends/magic_folder.py @@ -47,8 +47,13 @@ def is_new_file(pathinfo, db_entry): return True if not pathinfo.exists and db_entry.size is None: + print("NOT because", pathinfo.exists, db_entry.size) return False + print("NOT because", pathinfo.size, pathinfo.ctime, pathinfo.mtime, + db_entry.size, db_entry.ctime, db_entry.mtime, + ((pathinfo.size, pathinfo.ctime, pathinfo.mtime) != + (db_entry.size, db_entry.ctime, db_entry.mtime))) return ((pathinfo.size, pathinfo.ctime, pathinfo.mtime) != (db_entry.size, db_entry.ctime, db_entry.mtime)) @@ -210,7 +215,8 @@ class Uploader(QueueMixin): | IN_EXCL_UNLINK ) self._notifier.watch(self._local_filepath, mask=self.mask, callbacks=[self._notify], - recursive=True) + recursive=False)#True) + print "WATCHING", self._local_filepath def start_monitoring(self): self._log("start_monitoring") diff --git a/src/allmydata/scripts/magic_folder_cli.py b/src/allmydata/scripts/magic_folder_cli.py index b31162e6..7411cf5e 100644 --- a/src/allmydata/scripts/magic_folder_cli.py +++ b/src/allmydata/scripts/magic_folder_cli.py @@ -161,6 +161,7 @@ def join(options): "\nUse the 'tahoe magic-folder leave' command first.\n") return 1 + print("ZINGA", dmd_cap_file) fileutil.write(dmd_cap_file, dmd_write_cap) fileutil.write(collective_readcap_file, magic_readonly_cap) diff --git a/src/allmydata/test/test_magic_folder.py b/src/allmydata/test/test_magic_folder.py index c5873659..62cac038 100644 --- a/src/allmydata/test/test_magic_folder.py +++ b/src/allmydata/test/test_magic_folder.py @@ -1,5 +1,6 @@ import os, sys +import shutil from twisted.trial import unittest from twisted.internet import defer, task @@ -21,6 +22,8 @@ from allmydata import magicfolderdb, magicpath from allmydata.util.fileutil import abspath_expanduser_unicode from allmydata.immutable.upload import Data +from twisted.internet.base import DelayedCall +#DelayedCall.debug = True class MagicFolderTestMixin(MagicFolderCLITestMixin, ShouldFailMixin, ReallyEqualMixin, NonASCIIPathMixin): """ @@ -863,7 +866,7 @@ class MagicFolderTestMixin(MagicFolderCLITestMixin, ShouldFailMixin, ReallyEqual def Alice_to_delete_file(): print "Alice deletes the file!\n" - os.unlink(self.file_path) + shutil.move(self.file_path, self.file_path + u'.backup') self.notify(to_filepath(self.file_path), self.inotify.IN_DELETE, magic=self.alice_magicfolder) d.addCallback(_wait_for, Alice_to_delete_file) @@ -876,6 +879,9 @@ class MagicFolderTestMixin(MagicFolderCLITestMixin, ShouldFailMixin, ReallyEqual return d0 d.addCallback(notify_bob_moved) + # so on just-windows the above doesn't do IN_MOVED_FROM nor + # simulate same in RealTest; trying to compare to unix + d.addCallback(lambda ign: self._check_version_in_dmd(self.alice_magicfolder, u"file1", 1)) d.addCallback(lambda ign: self._check_version_in_local_db(self.alice_magicfolder, u"file1", 1)) d.addCallback(lambda ign: self._check_uploader_count('objects_failed', 0)) @@ -1206,7 +1212,10 @@ class RealTest(MagicFolderTestMixin, unittest.TestCase): # Writing to the filesystem causes the notification. # However, flushing filesystem buffers may be necessary on Windows. if flush: - fileutil.flush_volume(path.path) + try: + pass#fileutil.flush_volume(path.path) + except Exception: + pass # e.g. permission errors try: magic_folder.get_inotify_module() diff --git a/src/allmydata/util/fileutil.py b/src/allmydata/util/fileutil.py index 1d059fcc..c708044a 100644 --- a/src/allmydata/util/fileutil.py +++ b/src/allmydata/util/fileutil.py @@ -561,6 +561,7 @@ if sys.platform == "win32": None ) if hVolume == INVALID_HANDLE_VALUE: + print("ZINGA", abspath) raise WinError(get_last_error()) if FlushFileBuffers(hVolume) == 0: