diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2018-06-22 18:11:34 +0100 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2018-06-22 18:11:34 +0100 |
commit | 6b2980091903dacec2cf65d262290a316e0bb7c5 (patch) | |
tree | 74d1364d54bfc5a4348f58ae66164a356fb5a6cb | |
parent | 9da607cea6fe85da355b2e821d4bf534add13642 (diff) | |
download | sos-6b2980091903dacec2cf65d262290a316e0bb7c5.tar.gz |
[policies/redhat] handle UsrMove packages with content in /s?bin
Some packages in post-UsrMove Red Hat systems still install files
to /bin or /sbin: the RPM and mailx packages are known examples.
Treat these paths specially and ensure both the UsrMove and old
path are present in the list of package managed files.
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r-- | sos/plugins/unpackaged.py | 1 | ||||
-rw-r--r-- | sos/policies/redhat.py | 14 |
2 files changed, 14 insertions, 1 deletions
diff --git a/sos/plugins/unpackaged.py b/sos/plugins/unpackaged.py index c24a22f7..bf015dad 100644 --- a/sos/plugins/unpackaged.py +++ b/sos/plugins/unpackaged.py @@ -70,6 +70,7 @@ class Unpackaged(Plugin, RedHatPlugin): all_fsystem = [] all_frpm = set(self.policy.mangle_package_path( self.policy.package_manager.files)) + for d in get_env_path_list(): all_fsystem += all_files_system(d) not_packaged = [x for x in all_fsystem if x not in all_frpm] diff --git a/sos/policies/redhat.py b/sos/policies/redhat.py index 3d38be1b..f12cb847 100644 --- a/sos/policies/redhat.py +++ b/sos/policies/redhat.py @@ -122,8 +122,20 @@ class RedHatPolicy(LinuxPolicy): :param files: the list of package managed files """ + paths = [] + + def transform_path(path): + # Some packages actually own paths in /bin: in this case, + # duplicate the path as both the / and /usr version. + skip_paths = ["/bin/rpm", "/bin/mailx"] + if path in skip_paths: + return (path, os.path.join("/usr", path[1:])) + return (re.sub(r'(^)(/s?bin)', r'\1/usr\2', path),) + if self.usrmove: - return [re.sub(r'(^)(/s?bin)', r'\1/usr\2', f) for f in files] + for f in files: + paths.extend(transform_path(f)) + return paths else: return files |