diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2017-03-28 13:57:25 +0100 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2017-03-28 13:57:25 +0100 |
commit | 3d23564348799dfee88466f7439662c9d1e1b698 (patch) | |
tree | b87578ca78a5f4aac2922f48b770202916810166 /tests/report_tests.py | |
parent | 670a6c86348a0b6fad095485de1f660e808117f9 (diff) | |
download | sos-3d23564348799dfee88466f7439662c9d1e1b698.tar.gz |
[reporting] workaround six mishandling of '\$' strings
There is a problem with six's handling of strings that end with a
backslash:
https://bitbucket.org/gutworth/six/issues/60/sixu-mishandles-string-ending-in-backslash
This leads to an ugly exception during reporting if any filename
ends with this character:
Traceback (most recent call last):
File "/usr/sbin/sosreport", line 25, in <module>
main(sys.argv[1:])
File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 1632, in main
sos.execute()
File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 1607, in execute
self.plain_report()
File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 1358, in plain_report
output = PlainTextReport(report).unicode()
File "/usr/lib/python2.7/site-packages/sos/reporting.py", line 151, in unicode
else six.u(i)), buf))
File "/usr/lib/python2.7/site-packages/sos/reporting.py", line 151, in <lambda>
else six.u(i)), buf))
File "/usr/lib/python2.7/site-packages/six.py", line 647, in u
return unicode(s.replace(r'\\', r'\\\\'), "unicode_escape")
UnicodeDecodeError: 'unicodeescape' codec can't decode byte 0x5c in position 25: \ at end of string
Avoid this problem by re-packing the buffer and adding a single ' '
character to the end of any string ending with '\'.
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
Diffstat (limited to 'tests/report_tests.py')
0 files changed, 0 insertions, 0 deletions