Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Description of problem:
unpackaged reports false positives
unpackaged crashes if no unpackaged (or false positives) file found
Version-Release number of selected component (if applicable):
sos-3.6-7.el7.noarch
How reproducible:
Always
Steps to Reproduce:
1. # sosreport --batch --build -o unpackaged
Actual results:
false positives are found
sort -u /var/tmp/sosreport-.../sos_strings/unpackaged/unpackaged|wc -l
10
Expected results:
no false positives are found on clean install
Additional info:
some rpms doesn't list paths without '/usr' (notice to maintainers needed?)
skip_paths = ["/bin/rpm", "/bin/mailx"] in redhat.py:mangle_package_path() is not complete
proof-of-concept patch
--- sos/plugins/unpackaged.py.orig 2018-09-24 08:13:07.047477426 -0400
+++ sos/plugins/unpackaged.py 2018-09-24 08:51:41.899477426 -0400
@@ -74,7 +74,8 @@ class Unpackaged(Plugin, RedHatPlugin):
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]
+ not_packaged = [x for x in all_fsystem
+ if x not in all_frpm and "/usr" + x not in all_frpm]
not_packaged_expanded = format_output(not_packaged)
self.add_string_as_file('\n'.join(not_packaged_expanded), 'unpackaged')
prevents false positives
if the list is empty (expected on clean install) plugin crashes with
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 1116, in collect_plugin
plug.collect()
File "/usr/lib/python2.7/site-packages/sos/plugins/__init__.py", line 949, in collect
self._collect_strings()
File "/usr/lib/python2.7/site-packages/sos/plugins/__init__.py", line 930, in _collect_strings
content = string.splitlines()[0]
IndexError: list index out of range
this can be fixed with
--- sos/plugins/__init__.py.orig 2018-09-24 08:51:07.598477426 -0400
+++ sos/plugins/__init__.py 2018-09-24 08:51:30.877477426 -0400
@@ -725,7 +725,8 @@ class Plugin(object):
def add_string_as_file(self, content, filename):
"""Add a string to the archive as a file named `filename`"""
self.copy_strings.append((content, filename))
- content = content.splitlines()[0]
+ # empty content has no first line
+ if content: content = content.splitlines()[0]
if not isinstance(content, six.string_types):
content = content.decode('utf8', 'ignore')
self._log_debug("added string ...'%s' as '%s'" % (content, filename))
@@ -927,7 +928,8 @@ class Plugin(object):
def _collect_strings(self):
for string, file_name in self.copy_strings:
- content = string.splitlines()[0]
+ # empty string has no first line
+ content = string.splitlines()[0] if string else string
if not isinstance(content, six.string_types):
content = content.decode('utf8', 'ignore')
self._log_info("collecting string ...'%s' as '%s'"
The later has upstream PR inside #1422,
https://github.com/sosreport/sos/pull/1422/commits/4280f7db3e231ce94b3141ee7358c726fe3c9100
in particular.
The former: the problem seems to be elsewhere, as on my system I have in the sos_strings/unpackaged/unpackaged files like:
1)
/bin/systemctl - this is due to:
# rpm -ql systemd | grep /bin/systemctl
/usr/bin/systemctl
#
while /bin is a symlink to /usr/bin we dont expand.
2)
/bin/tracepath6 - b'cos all_frpm collects /usr/sbin/tracepath6 (that is a symlink to /bin/tracepath6), instead of the symlink target itself - so opposite problem to 1)
I.e. we have to collect and compare "readlink -f .." when building all_frpm and all_files_system(d).
The second shall be fixed by patch:
--- /usr/lib/python2.7/site-packages/sos/plugins/unpackaged.py 2018-09-14 22:37:50.000000000 +0200
+++ /usr/lib/python2.7/site-packages/sos/plugins/unpackaged.py-new 2018-09-24 16:51:33.066456699 +0200
@@ -51,9 +51,9 @@ 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
@@ -69,7 +69,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():
Filip, can you please try it? Or provide access to the system you see some remaining problem (after applying this patch and other than the string.splitlines()[0])?
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.
https://access.redhat.com/errata/RHEA-2019:2295
Description of problem: unpackaged reports false positives unpackaged crashes if no unpackaged (or false positives) file found Version-Release number of selected component (if applicable): sos-3.6-7.el7.noarch How reproducible: Always Steps to Reproduce: 1. # sosreport --batch --build -o unpackaged Actual results: false positives are found sort -u /var/tmp/sosreport-.../sos_strings/unpackaged/unpackaged|wc -l 10 Expected results: no false positives are found on clean install Additional info: some rpms doesn't list paths without '/usr' (notice to maintainers needed?) skip_paths = ["/bin/rpm", "/bin/mailx"] in redhat.py:mangle_package_path() is not complete proof-of-concept patch --- sos/plugins/unpackaged.py.orig 2018-09-24 08:13:07.047477426 -0400 +++ sos/plugins/unpackaged.py 2018-09-24 08:51:41.899477426 -0400 @@ -74,7 +74,8 @@ class Unpackaged(Plugin, RedHatPlugin): 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] + not_packaged = [x for x in all_fsystem + if x not in all_frpm and "/usr" + x not in all_frpm] not_packaged_expanded = format_output(not_packaged) self.add_string_as_file('\n'.join(not_packaged_expanded), 'unpackaged') prevents false positives if the list is empty (expected on clean install) plugin crashes with Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 1116, in collect_plugin plug.collect() File "/usr/lib/python2.7/site-packages/sos/plugins/__init__.py", line 949, in collect self._collect_strings() File "/usr/lib/python2.7/site-packages/sos/plugins/__init__.py", line 930, in _collect_strings content = string.splitlines()[0] IndexError: list index out of range this can be fixed with --- sos/plugins/__init__.py.orig 2018-09-24 08:51:07.598477426 -0400 +++ sos/plugins/__init__.py 2018-09-24 08:51:30.877477426 -0400 @@ -725,7 +725,8 @@ class Plugin(object): def add_string_as_file(self, content, filename): """Add a string to the archive as a file named `filename`""" self.copy_strings.append((content, filename)) - content = content.splitlines()[0] + # empty content has no first line + if content: content = content.splitlines()[0] if not isinstance(content, six.string_types): content = content.decode('utf8', 'ignore') self._log_debug("added string ...'%s' as '%s'" % (content, filename)) @@ -927,7 +928,8 @@ class Plugin(object): def _collect_strings(self): for string, file_name in self.copy_strings: - content = string.splitlines()[0] + # empty string has no first line + content = string.splitlines()[0] if string else string if not isinstance(content, six.string_types): content = content.decode('utf8', 'ignore') self._log_info("collecting string ...'%s' as '%s'"