Blame SOURCES/sos-bz829069-normalise-tmp-dir-path.patch

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