aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2014-10-30 16:46:01 +0000
committerBryn M. Reeves <bmr@redhat.com>2014-10-30 16:46:01 +0000
commitd7759d3ddae5fe99a340c88a1d370d65cfa73fd6 (patch)
tree6d4353899bcdecf7fdb6b8c578ac805081f729e6
parent48a99c95078bab306cb56bb1a05420d88bf15a64 (diff)
downloadsos-d7759d3ddae5fe99a340c88a1d370d65cfa73fd6.tar.gz
[sosreport] fix archive permissions regression
Restore the umask save/restore around archive creation and ensure the effective umask is 077 at the time of archive creation. Fixes #425. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r--sos/sosreport.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/sos/sosreport.py b/sos/sosreport.py
index 664414f5..99b5f470 100644
--- a/sos/sosreport.py
+++ b/sos/sosreport.py
@@ -1327,6 +1327,7 @@ class SoSReport(object):
self._finish_logging()
# package up the results for the support organization
if not self.opts.build:
+ old_umask = os.umask(0o077)
if not self.opts.quiet:
print(_("Creating compressed archive..."))
# compression could fail for a number of reasons
@@ -1345,6 +1346,8 @@ class SoSReport(object):
raise
else:
return False
+ finally:
+ os.umask(old_umask)
else:
final_filename = self.archive.get_archive_path()
self.policy.display_results(final_filename, build=self.opts.build)