Bug 1870874
| Summary: | sos fails when a file to be collected has non-utf 8 characters in file name | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 8 | Reporter: | roarora |
| Component: | sos | Assignee: | Pavel Moravec <pmoravec> |
| Status: | CLOSED WONTFIX | QA Contact: | Miroslav HradĂlek <mhradile> |
| Severity: | low | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | --- | CC: | agk, bmr, mhradile, plambri, sbradley |
| Target Milestone: | rc | Flags: | pm-rhel:
mirror+
|
| Target Release: | 8.0 | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2022-02-20 07:27:12 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
|
Description
roarora
2020-08-20 21:59:35 UTC
Nice catch. And when the file has some content, we see two uncaught exceptions (even on upstream sos):
date > '/etc/yum.repos.d/team'$'\303''_epel.repo'
python3 bin/sos report -o yum --batch --build
..
Starting 1/1 yum [Running: yum]
--- Logging error ---
Traceback (most recent call last):
File "/usr/lib64/python3.6/logging/__init__.py", line 996, in emit
stream.write(msg)
UnicodeEncodeError: 'utf-8' codec can't encode character '\udcc3' in position 81: surrogates not allowed
Call stack:
File "/usr/lib64/python3.6/threading.py", line 884, in _bootstrap
self._bootstrap_inner()
File "/usr/lib64/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/usr/lib64/python3.6/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "/usr/lib64/python3.6/concurrent/futures/thread.py", line 69, in _worker
work_item.run()
File "/usr/lib64/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/root/sos-master/sos/report/__init__.py", line 963, in collect_plugin
plug.collect()
File "/root/sos-master/sos/report/plugins/__init__.py", line 2442, in collect
self._collect_copy_specs()
File "/root/sos-master/sos/report/plugins/__init__.py", line 2409, in _collect_copy_specs
self._log_info("collecting path '%s'" % path)
File "/root/sos-master/sos/report/plugins/__init__.py", line 601, in _log_info
self.soslog.info(self._format_msg(msg))
Message: "[plugin:yum] collecting path '/etc/yum.repos.d/team\udcc3_epel.repo'"
Arguments: ()
Finished running plugins
Traceback (most recent call last):
File "bin/sos", line 22, in <module>
sos.execute()
File "/root/sos-master/sos/__init__.py", line 185, in execute
self._component.execute()
File "/root/sos-master/sos/report/__init__.py", line 1338, in execute
self.generate_reports()
File "/root/sos-master/sos/report/__init__.py", line 1065, in generate_reports
fd.write(output)
UnicodeEncodeError: 'utf-8' codec can't encode character '\udcc3' in position 734: surrogates not allowed
The root cause is the same in both cases. And it should be the same when sosreport calls a command with non-UTF8 character, like:
modprobe dummy
ip link add 'team'$'\303''_epel.repo' type dummy
python3 bin/sos report -o networking --batch --build
..
(tons of below errors)
..
--- Logging error ---
Traceback (most recent call last):
File "/usr/lib64/python3.6/logging/__init__.py", line 996, in emit
stream.write(msg)
UnicodeEncodeError: 'utf-8' codec can't encode character '\udcc3' in position 87: surrogates not allowed
Call stack:
File "/usr/lib64/python3.6/threading.py", line 884, in _bootstrap
self._bootstrap_inner()
File "/usr/lib64/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/usr/lib64/python3.6/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "/usr/lib64/python3.6/concurrent/futures/thread.py", line 69, in _worker
work_item.run()
File "/usr/lib64/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/root/sos-master/sos/report/__init__.py", line 963, in collect_plugin
plug.collect()
File "/root/sos-master/sos/report/plugins/__init__.py", line 2443, in collect
self._collect_cmds()
File "/root/sos-master/sos/report/plugins/__init__.py", line 2416, in _collect_cmds
self._log_info("collecting output of '%s'" % soscmd.cmd)
File "/root/sos-master/sos/report/plugins/__init__.py", line 601, in _log_info
self.soslog.info(self._format_msg(msg))
Message: "[plugin:networking] collecting output of 'ethtool -e team\udcc3_epel.repo'"
Arguments: ()
Finished running plugins
Traceback (most recent call last):
File "bin/sos", line 22, in <module>
sos.execute()
File "/root/sos-master/sos/__init__.py", line 185, in execute
self._component.execute()
File "/root/sos-master/sos/report/__init__.py", line 1338, in execute
self.generate_reports()
File "/root/sos-master/sos/report/__init__.py", line 1065, in generate_reports
fd.write(output)
UnicodeEncodeError: 'utf-8' codec can't encode character '\udcc3' in position 931: surrogates not allowed
Possible idea of a fix: https://github.com/sosreport/sos/issues/2790 After evaluating this issue, there are no plans to address it further or fix it in an upcoming release. Therefore, it is being closed. If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened. |