[oe-commits] [openembedded-core] 16/28: qemurunner.py: ignore decode errors

git at git.openembedded.org git at git.openembedded.org
Tue Mar 7 22:15:24 UTC 2017


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit 0e02679506ffae6f9dd58f372c1c184060540409
Author: Ed Bartosh <ed.bartosh at linux.intel.com>
AuthorDate: Mon Mar 6 17:10:12 2017 +0200

    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.
    
    Signed-off-by: Ed Bartosh <ed.bartosh at linux.intel.com>
    Signed-off-by: Ross Burton <ross.burton at intel.com>
---
 meta/lib/oeqa/utils/qemurunner.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py
index 19f0f92..59dc11d 100644
--- a/meta/lib/oeqa/utils/qemurunner.py
+++ b/meta/lib/oeqa/utils/qemurunner.py
@@ -74,7 +74,7 @@ class QemuRunner:
         if self.logfile:
             # It is needed to sanitize the data received from qemu
             # because is possible to have control characters
-            msg = msg.decode("utf-8")
+            msg = msg.decode("utf-8", errors='ignore')
             msg = re_control_char.sub('', msg)
             with codecs.open(self.logfile, "a", encoding="utf-8") as f:
                 f.write("%s" % msg)

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list