From e99658f21136401a32934963b2dde2b0bce13d64 Mon Sep 17 00:00:00 2001 From: David Stainton Date: Tue, 8 Dec 2015 03:01:19 +0200 Subject: [PATCH] Add download.umask config option with default of 077 --- src/allmydata/client.py | 4 ++-- src/allmydata/frontends/magic_folder.py | 6 +++--- src/allmydata/test/test_magic_folder.py | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/allmydata/client.py b/src/allmydata/client.py index 7013a4f2..9a0a5de8 100644 --- a/src/allmydata/client.py +++ b/src/allmydata/client.py @@ -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() diff --git a/src/allmydata/frontends/magic_folder.py b/src/allmydata/frontends/magic_folder.py index 317500a9..a40c8c56 100644 --- a/src/allmydata/frontends/magic_folder.py +++ b/src/allmydata/frontends/magic_folder.py @@ -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): diff --git a/src/allmydata/test/test_magic_folder.py b/src/allmydata/test/test_magic_folder.py index 8a8fb045..f8401b85 100644 --- a/src/allmydata/test/test_magic_folder.py +++ b/src/allmydata/test/test_magic_folder.py @@ -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 -- 2.45.2