commit 2b2fa228391a0188a375a9e3c1e8f03f69c7eafd
Author: Bryn M. Reeves <bmr@redhat.com>
Date: Thu Nov 7 16:27:44 2013 +0000
Normalize temporary directory path
The archive and temporary file handling classes expect to operate
on absolute paths. If a user specifies a relative path via the
command line --tmp-dir switch it must be normalized before being
passed to these classes to provide correct behaviour. Failing to
do this causes a variety of errors: the final archive cannot be
created since the path is constructed incorrectly and temporary
files are not cleaned up since they are not at the "expected"
location.
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
diff --git a/sos/sosreport.py b/sos/sosreport.py
index 2451439..b1f2e1d 100644
--- a/sos/sosreport.py
+++ b/sos/sosreport.py
@@ -534,7 +534,8 @@ class SoSReport(object):
self._read_config()
self.policy = sos.policies.load()
self._is_root = self.policy.is_root()
- self.tmpdir = self.policy.get_tmp_dir(self.opts.tmp_dir)
+ self.tmpdir = os.path.abspath(
+ self.policy.get_tmp_dir(self.opts.tmp_dir))
if not os.path.isdir(self.tmpdir) \
or not os.access(self.tmpdir, os.W_OK):
# write directly to stderr as logging is not initialised yet