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:
sos-report logs an error.
[nkresic@fubar sos_logs]$ cat grub2-plugin-errors.txt
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 1252, in setup
plug.setup()
File "/usr/lib/python2.7/site-packages/sos/plugins/grub2.py", line 34, in setup
"/etc/grub.d"
File "/usr/lib/python2.7/site-packages/sos/plugins/__init__.py", line 572, in add_copy_spec
files.sort(key=getmtime, reverse=True)
File "/usr/lib/python2.7/site-packages/sos/plugins/__init__.py", line 569, in getmtime
except (OSError, FileNotFoundError):
NameError: global name 'FileNotFoundError' is not defined
Possibly a "global name" is defined, that does not exist in python 2.7 ?
Version-Release number of selected component (if applicable):
sos-3.5-6.el7.noarch
python-2.7.5-66.el7.x86_64
How reproducible:
While collecting a normal sos-report, no special flags set
Steps to Reproduce:
1. start sosreport collection
2. wait until finished
3. check for run logs, found a file grub2-plugin-errors.txt with the above error
Actual results:
python throws an exception NameError: global name 'FileNotFoundError' is not defined
Expected results:
No errors
Additional info:
This is a bit strange: that line of code has been present since last May, and we've not seen this previously. It looks as though Python only cares about this in the case that the exception is taken:
>>> try:
... print("foo")
... except (OSError, FileNotFoundError):
... print("qux")
...
foo
>>> try:
... raise OSError
... except (OSError, FileNotFoundError):
... print("qux")
...
Traceback (most recent call last):
File "<stdin>", line 3, in <module>
NameError: name 'FileNotFoundError' is not defined
And poking about other py2 packages I see matplotlib is using Six to determine the exception class to use:
matplotlib/dviread.py
389 if tfm is None:
390 if six.PY2:
391 error_class = OSError
392 else:
393 error_class = FileNotFoundError
394 raise error_class("missing font metrics file: %s" % fontname)
So it seems like in this case the stat() failed for a file that appeared to exist in the file system (it's a path formed by glob expansion in Plugin._expand_copy_spec()). That's a bit strange and we should try to understand what happened there.
There are only two references to this exception class in sos so it's a simple fix but too late for 7.5.0 now.
This is due to the fact FileNotFoundError exception does not occur in python2 and getmtime was called to a non-existing file (where python raises OSError instead).
IMHO we shall replace the catch by EnvironmentError class that covers both types.
re-scheduling for inclusion in 7.6. Though reproducr isnt known (/me trying one artificial now), the PR shall fix it either way - just hard to verify it.
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-2018:3144
Description of problem: sos-report logs an error. [nkresic@fubar sos_logs]$ cat grub2-plugin-errors.txt Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 1252, in setup plug.setup() File "/usr/lib/python2.7/site-packages/sos/plugins/grub2.py", line 34, in setup "/etc/grub.d" File "/usr/lib/python2.7/site-packages/sos/plugins/__init__.py", line 572, in add_copy_spec files.sort(key=getmtime, reverse=True) File "/usr/lib/python2.7/site-packages/sos/plugins/__init__.py", line 569, in getmtime except (OSError, FileNotFoundError): NameError: global name 'FileNotFoundError' is not defined Possibly a "global name" is defined, that does not exist in python 2.7 ? Version-Release number of selected component (if applicable): sos-3.5-6.el7.noarch python-2.7.5-66.el7.x86_64 How reproducible: While collecting a normal sos-report, no special flags set Steps to Reproduce: 1. start sosreport collection 2. wait until finished 3. check for run logs, found a file grub2-plugin-errors.txt with the above error Actual results: python throws an exception NameError: global name 'FileNotFoundError' is not defined Expected results: No errors Additional info: