Blame SOURCES/sos-bz1158891-sosreport-fix-archive-permissions-regression.patch

e75bc7
From d7759d3ddae5fe99a340c88a1d370d65cfa73fd6 Mon Sep 17 00:00:00 2001
e75bc7
From: "Bryn M. Reeves" <bmr@redhat.com>
e75bc7
Date: Thu, 30 Oct 2014 16:46:01 +0000
e75bc7
Subject: [PATCH] [sosreport] fix archive permissions regression
e75bc7
e75bc7
Restore the umask save/restore around archive creation and ensure
e75bc7
the effective umask is 077 at the time of archive creation.
e75bc7
e75bc7
Fixes #425.
e75bc7
e75bc7
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
e75bc7
---
e75bc7
 sos/sosreport.py | 3 +++
e75bc7
 1 file changed, 3 insertions(+)
e75bc7
e75bc7
diff --git a/sos/sosreport.py b/sos/sosreport.py
e75bc7
index 664414f..99b5f47 100644
e75bc7
--- a/sos/sosreport.py
e75bc7
+++ b/sos/sosreport.py
e75bc7
@@ -1327,6 +1327,7 @@ class SoSReport(object):
e75bc7
         self._finish_logging()
e75bc7
         # package up the results for the support organization
e75bc7
         if not self.opts.build:
e75bc7
+            old_umask = os.umask(0o077)
e75bc7
             if not self.opts.quiet:
e75bc7
                 print(_("Creating compressed archive..."))
e75bc7
             # compression could fail for a number of reasons
e75bc7
@@ -1345,6 +1346,8 @@ class SoSReport(object):
e75bc7
                     raise
e75bc7
                 else:
e75bc7
                     return False
e75bc7
+            finally:
e75bc7
+                os.umask(old_umask)
e75bc7
         else:
e75bc7
             final_filename = self.archive.get_archive_path()
e75bc7
         self.policy.display_results(final_filename, build=self.opts.build)
e75bc7
-- 
e75bc7
1.9.3
e75bc7