From: David Stainton Date: Tue, 8 Dec 2015 01:01:19 +0000 (+0200) Subject: Add download.umask config option with default of 077 X-Git-Url: https://git.rkrishnan.org/%5B/frontends/%22file:/flags/?a=commitdiff_plain;h=d2170d76c0c5bf394f29072482649880880f2e9c;p=tahoe-lafs%2Ftahoe-lafs.git Add download.umask config option with default of 077 --- diff --git a/src/allmydata/client.py b/src/allmydata/client.py index ef158407..62d99b04 100644 --- a/src/allmydata/client.py +++ b/src/allmydata/client.py @@ -511,8 +511,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 dddffb92..e1fbff61 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 dbc91a8f..742a9636 100644 --- a/src/allmydata/test/test_magic_folder.py +++ b/src/allmydata/test/test_magic_folder.py @@ -1122,7 +1122,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