]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
WIP and debugging things 1431.windows-fixes.0
authormeejah <meejah@meejah.ca>
Tue, 15 Dec 2015 16:02:58 +0000 (08:02 -0800)
committerDaira Hopwood <daira@jacaranda.org>
Thu, 14 Jan 2016 17:27:07 +0000 (17:27 +0000)
src/allmydata/frontends/magic_folder.py
src/allmydata/scripts/magic_folder_cli.py
src/allmydata/test/test_magic_folder.py
src/allmydata/util/fileutil.py

index 353b8facc8d2e2ad14d7448667dd20e8bd180353..224b60976865be39b90101075eccadb4dffd0266 100644 (file)
@@ -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")
index b31162e66a8e536afadb2da073a7c7d74f60e1b2..7411cf5e0ef165700985fb4b38365545d8a777ea 100644 (file)
@@ -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)
 
index c58736594acfcccdfd7b9742f4bc2d6f9a5fa9c4..62cac038524aa25a033fcf2e279a0169c6a736b2 100644 (file)
@@ -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()
index 1d059fcce883e9cba523f384930d2b07d5357b3d..c708044aaf4fdbec6a654193ef1cf4fbe7cbc2df 100644 (file)
@@ -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: