summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2017-03-06 17:10:12 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-03-08 11:52:56 +0000
commitac462e464f8bb879f54d9de14b8b2744fa8c6419 (patch)
tree8494995f6549b0921ad80060153b8fa570b55133 /meta
parent55fc115d93931f6d10f460fe64ece3dd8a627389 (diff)
downloadpoky-ac462e464f8bb879f54d9de14b8b2744fa8c6419.tar.gz
qemurunner.py: ignore decode errors
qemu output can contain control characters. This cause qemurunner API to crash when decoding the output to utf-8: Traceback (most recent call last): File "/usr/lib64/python3.4/threading.py", line 911, in _bootstrap_inner self.run() File "meta/lib/oeqa/utils/qemurunner.py", line 472, in run threading.Thread.run(self) File "/usr/lib64/python3.4/threading.py", line 859, in run self._target(*self._args, **self._kwargs) File "meta/lib/oeqa/utils/qemurunner.py", line 465, in threadtarget self.eventloop() File "meta/lib/oeqa/utils/qemurunner.py", line 526, in eventloop self.logfunc(data) File "meta/lib/oeqa/utils/qemurunner.py", line 77, in log msg = msg.decode("utf-8") UnicodeDecodeError: 'utf-8' codec can't decode byte 0xda in position 0: unexpected end of data Added errors='ignore' to decode call to fix this. (From OE-Core rev: 4a46dd5190d97fdcb6297a0c1d8c824d425c4c51) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/lib/oeqa/utils/qemurunner.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py
index 19f0f92b74..59dc11d00f 100644
--- a/meta/lib/oeqa/utils/qemurunner.py
+++ b/meta/lib/oeqa/utils/qemurunner.py
@@ -74,7 +74,7 @@ class QemuRunner:
74 if self.logfile: 74 if self.logfile:
75 # It is needed to sanitize the data received from qemu 75 # It is needed to sanitize the data received from qemu
76 # because is possible to have control characters 76 # because is possible to have control characters
77 msg = msg.decode("utf-8") 77 msg = msg.decode("utf-8", errors='ignore')
78 msg = re_control_char.sub('', msg) 78 msg = re_control_char.sub('', msg)
79 with codecs.open(self.logfile, "a", encoding="utf-8") as f: 79 with codecs.open(self.logfile, "a", encoding="utf-8") as f:
80 f.write("%s" % msg) 80 f.write("%s" % msg)