aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2013-11-07 16:27:44 +0000
committerBryn M. Reeves <bmr@redhat.com>2013-11-07 16:27:44 +0000
commit2b2fa228391a0188a375a9e3c1e8f03f69c7eafd (patch)
tree3216931c116156fd9d5427c02fa166e22719688c
parent0ff6200d0b6f6d38d09eed49b1ec9fd55eb38a91 (diff)
downloadsos-2b2fa228391a0188a375a9e3c1e8f03f69c7eafd.tar.gz
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>
-rw-r--r--sos/sosreport.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/sos/sosreport.py b/sos/sosreport.py
index 2451439b..b1f2e1d0 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