aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Moravec <pmoravec@redhat.com>2018-09-24 20:09:47 +0200
committerBryn M. Reeves <bmr@redhat.com>2018-12-14 11:20:39 +0000
commit549591879a01edcb856f7f353af9d6324d469c39 (patch)
treefc566f452be61baa39765928a3e6134f0ca34957
parent036bbd0fa4c85f97da536717673ca0b668dd5276 (diff)
downloadsos-549591879a01edcb856f7f353af9d6324d469c39.tar.gz
[unpackaged] compare realpaths of files
To compare files in $PATH with files installed from a package, we must expand all symlinks to their realpaths. Otherwise we get false positives like /bin/systemctl (as /bin -> /usr/bin). Resolves: #1437 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
-rw-r--r--sos/plugins/unpackaged.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/sos/plugins/unpackaged.py b/sos/plugins/unpackaged.py
index 4c065e11..91de9de2 100644
--- a/sos/plugins/unpackaged.py
+++ b/sos/plugins/unpackaged.py
@@ -45,9 +45,10 @@ class Unpackaged(Plugin, RedHatPlugin):
path = os.path.abspath(os.readlink(path))
except Exception:
continue
- file_list.append(path)
+ file_list.append(os.path.realpath(path))
for name in dirs:
- file_list.append(os.path.join(root, name))
+ file_list.append(os.path.realpath(
+ os.path.join(root, name)))
return file_list
@@ -63,7 +64,8 @@ class Unpackaged(Plugin, RedHatPlugin):
return expanded
all_fsystem = []
- all_frpm = set(self.policy.mangle_package_path(
+ all_frpm = set(os.path.realpath(x)
+ for x in self.policy.mangle_package_path(
self.policy.package_manager.files))
for d in get_env_path_list():