]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
Add download.umask config option with default of 077
authorDavid Stainton <dstainton415@gmail.com>
Tue, 8 Dec 2015 01:01:19 +0000 (03:01 +0200)
committerDaira Hopwood <daira@jacaranda.org>
Fri, 5 Feb 2016 21:59:38 +0000 (21:59 +0000)
src/allmydata/client.py
src/allmydata/frontends/magic_folder.py
src/allmydata/test/test_magic_folder.py

index 7013a4f2d17698c9af89f94a002894d1fa91a950..9a0a5de8334a19ef4d8546fc3eed5258df4fcfc2 100644 (file)
@@ -513,8 +513,8 @@ class Client(node.Node, pollmixin.PollMixin):
             dbfile = abspath_expanduser_unicode(dbfile)
 
             from allmydata.frontends import magic_folder
-
-            s = magic_folder.MagicFolder(self, upload_dircap, collective_dircap, local_dir, dbfile)
+            umask = self.get_config("magic_folder", "download.umask", 0077)
+            s = magic_folder.MagicFolder(self, upload_dircap, collective_dircap, local_dir, dbfile, umask)
             s.setServiceParent(self)
             s.startService()
 
index 317500a935a51ede05140dbfed04539b338e7b5c..a40c8c56af021fe8bbbdfc559c67915b93d06943 100644 (file)
@@ -56,7 +56,7 @@ def is_new_file(pathinfo, db_entry):
 class MagicFolder(service.MultiService):
     name = 'magic-folder'
 
-    def __init__(self, client, upload_dircap, collective_dircap, local_path_u, dbfile,
+    def __init__(self, client, upload_dircap, collective_dircap, local_path_u, dbfile, umask,
                  pending_delay=1.0, clock=None):
         precondition_abspath(local_path_u)
 
@@ -77,7 +77,7 @@ class MagicFolder(service.MultiService):
 
         self.uploader = Uploader(client, local_path_u, db, upload_dirnode, pending_delay, clock, immediate)
         self.downloader = Downloader(client, local_path_u, db, collective_dirnode,
-                                     upload_dirnode.get_readonly_uri(), clock, self.uploader.is_pending)
+                                     upload_dirnode.get_readonly_uri(), clock, self.uploader.is_pending, umask)
 
     def startService(self):
         # TODO: why is this being called more than once?
@@ -527,7 +527,7 @@ class Downloader(QueueMixin, WriteFileMixin):
     REMOTE_SCAN_INTERVAL = 3  # facilitates tests
 
     def __init__(self, client, local_path_u, db, collective_dirnode,
-                 upload_readonly_dircap, clock, is_upload_pending, umask = 0123):
+                 upload_readonly_dircap, clock, is_upload_pending, umask):
         QueueMixin.__init__(self, client, local_path_u, db, 'downloader', clock)
 
         if not IDirectoryNode.providedBy(collective_dirnode):
index 8a8fb04521f2cad319ae383dfdfdc0c2d6376363..f8401b85c485755ab833d63fafc9d044ac1a015c 100644 (file)
@@ -1118,7 +1118,7 @@ class MockTest(MagicFolderTestMixin, unittest.TestCase):
                 pass
 
         writefile = TestWriteFileMixin()
-        writefile._umask = 0123
+        writefile._umask = 0077
 
         # create a file with name "foobar" with content "foo"
         # write downloaded file content "bar" into "foobar" with is_conflict = False