sos/SOURCES/sos-bz1891562-tmp-dir-relat...

35 lines
1.2 KiB
Diff

From c07bdbc94269603d2b910ccafa289512478160aa Mon Sep 17 00:00:00 2001
From: Jake Hunsaker <jhunsake@redhat.com>
Date: Mon, 26 Oct 2020 14:11:56 -0400
Subject: [PATCH] [sos] Fix use of relative paths for --tmp-dir
Fixes an issue where the use of relative paths for `--tmp-dir` causes a
failure in the building of the final archive. Previously, a relative
path would cause the tarball to be produced in a nested directory under
the temp directory of the same name, which would in turn cause
compression and all further operations for the archive to fail.
Fix this by converting relative paths in the option to the absolute path
internally.
Resolves: RHBZ#1891562
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
---
sos/component.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sos/component.py b/sos/component.py
index 0aef770c6..b44fdf829 100644
--- a/sos/component.py
+++ b/sos/component.py
@@ -138,7 +138,7 @@ def get_tmpdir_default(self):
use a standardized env var to redirect to the host's filesystem instead
"""
if self.opts.tmp_dir:
- return self.opts.tmp_dir
+ return os.path.abspath(self.opts.tmp_dir)
tmpdir = '/var/tmp'