diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2014-04-29 19:02:43 +0100 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2014-04-29 19:02:43 +0100 |
commit | 8d2577786cce6fcc915836108e405dbf5025dec8 (patch) | |
tree | dae028e4291f3a8ee1049d9ff441bb772cf629ba | |
parent | d21e3a56803d106752a8c9c8418979a7f8d1c320 (diff) | |
download | sos-8d2577786cce6fcc915836108e405dbf5025dec8.tar.gz |
Drop cwd/umask shenanigans from TarFileArchive::finalize()
It was necessary to save and restore old_cwd and the umask around
calls to an external archive program. This isn't needed when
using native python implementations and causes problems in the
case that the current working directory no longer exists:
Creating compressed archive...
going to finalize
did finalize exception: [Errno 2] No such file or directory
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
Traceback (most recent call last):
File "/sbin/sosreport", line 23, in <module>
main(sys.argv[1:])
File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 1233, in main
sos.execute()
File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 1222, in execute
return self.final_work()
File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 1159, in final_work
raise e
OSError: [Errno 2] No such file or directory
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r-- | sos/archive.py | 4 |
1 files changed, 0 insertions, 4 deletions
diff --git a/sos/archive.py b/sos/archive.py index 0f65c747..ea9e744e 100644 --- a/sos/archive.py +++ b/sos/archive.py @@ -259,15 +259,11 @@ class TarFileArchive(FileCacheArchive): return "%s.%s" % (self._name, self._suffix) def _build_archive(self): - old_pwd = os.getcwd() - old_umask = os.umask(0o077) os.chdir(self._tmp_dir) tar = tarfile.open(self._archive_name, mode="w") tar.add(os.path.split(self._name)[1], filter=self.copy_permissions_filter) tar.close() - os.umask(old_umask) - os.chdir(old_pwd) def _compress(self): methods = ['xz', 'bzip2', 'gzip'] |