[PATCH] D107887: scan-build-py: Force the opening in utf-8
Sylvestre Ledru via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 11 02:53:32 PDT 2021
sylvestre.ledru created this revision.
sylvestre.ledru added reviewers: phosek, isthismyaccount, aabbaabb.
Herald added a subscriber: whisperity.
sylvestre.ledru requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
It fails on ubuntu bionic otherwise with:
scan-build-py-14: Run 'scan-view /tmp/scan-build-2021-08-09-09-14-36-765350-nx9s888s' to examine bug reports.
scan-build-py-14: Internal error.
Traceback (most recent call last):
File "/usr/lib/llvm-14/lib/libscanbuild/__init__.py", line 125, in wrapper
return function(*args, **kwargs)
File "/usr/lib/llvm-14/lib/libscanbuild/analyze.py", line 72, in scan_build
number_of_bugs = document(args)
File "/usr/lib/llvm-14/lib/libscanbuild/report.py", line 35, in document
for bug in read_bugs(args.output, html_reports_available):
File "/usr/lib/llvm-14/lib/libscanbuild/report.py", line 282, in read_bugs
for bug in parser(bug_file):
File "/usr/lib/llvm-14/lib/libscanbuild/report.py", line 421, in parse_bug_html
for line in handler.readlines():
File "/usr/lib/python3.6/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 3360: ordinal not in range(128)
scan-build-py-14: Please run this command again and turn on verbose mode (add '-vvvv' as argument).
I guess it is caused by a problem in Python 3.6
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D107887
Files:
clang/tools/scan-build-py/lib/libscanbuild/report.py
Index: clang/tools/scan-build-py/lib/libscanbuild/report.py
===================================================================
--- clang/tools/scan-build-py/lib/libscanbuild/report.py
+++ clang/tools/scan-build-py/lib/libscanbuild/report.py
@@ -417,7 +417,7 @@
'bug_path_length': 1
}
- with open(filename) as handler:
+ with open(filename, encoding="utf-8") as handler:
for line in handler.readlines():
# do not read the file further
if endsign.match(line):
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107887.365703.patch
Type: text/x-patch
Size: 516 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210811/b6e5182a/attachment.bin>
More information about the cfe-commits
mailing list