Blob Blame History Raw
From 9fb39f8a211cf3d4f528aa7875eeb599096ecf24 Mon Sep 17 00:00:00 2001
From: "Bryn M. Reeves" <bmr@redhat.com>
Date: Thu, 29 Jan 2015 20:30:31 +0000
Subject: [PATCH] [plugins] do not strip SYSROOT when copying link targets

The abspath() call in _copy_symlink returns a host-relative path
(when SYSROOT is not '/'). Pass this directly to _do_copy_path()
without stripping the SYSROOT path component.

Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
---
 sos/plugins/__init__.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py
index 29ce3b8..d8c6b69 100644
--- a/sos/plugins/__init__.py
+++ b/sos/plugins/__init__.py
@@ -265,7 +265,8 @@ class Plugin(object):
         # the target stored in the original symlink
         linkdest = os.readlink(srcpath)
         dest = os.path.join(os.path.dirname(srcpath), linkdest)
-        # absolute path to the link target
+        # Absolute path to the link target. If SYSROOT != '/' this path
+        # is relative to the host root file system.
         absdest = os.path.normpath(dest)
         # adjust the target used inside the report to always be relative
         if os.path.isabs(linkdest):
@@ -290,7 +291,8 @@ class Plugin(object):
         # to absolute paths to pass to _do_copy_path.
         self._log_debug("normalized link target '%s' as '%s'"
                         % (linkdest, absdest))
-        self._do_copy_path(self.strip_sysroot(absdest))
+
+        self._do_copy_path(absdest)
 
         self.copied_files.append({'srcpath': srcpath,
                                   'dstpath': dstpath,
-- 
1.9.3