]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
qemurunner: Use backslashreplace with utf8 to make invalid characters clear
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 4 Oct 2023 12:22:40 +0000 (13:22 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 4 Oct 2023 22:05:45 +0000 (23:05 +0100)
Switch to the backslashreplace error handling when decoding strings so that
invalid characters are clear in the stream to improve debugging.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oeqa/utils/qemurunner.py

index b8f51112861e1e58ec56c8564cdfbe01ff315943..b738a261d879b6f4b2284e20d3710be9457982af 100644 (file)
@@ -109,7 +109,7 @@ class QemuRunner:
 
     def decode_qemulog(self, todecode):
         # Sanitize the data received from qemu as it may contain control characters
-        msg = todecode.decode("utf-8", errors='ignore')
+        msg = todecode.decode("utf-8", errors='backslashreplace')
         msg = re_control_char.sub('', msg)
         return msg
 
@@ -473,7 +473,7 @@ class QemuRunner:
                         self.logger.error('Invalid file type: %s\n%s' % (file))
                         read = b''
 
-                    self.logger.debug2('Partial boot log:\n%s' % (read.decode('utf-8', errors='ignore')))
+                    self.logger.debug2('Partial boot log:\n%s' % (read.decode('utf-8', errors='backslashreplace')))
                     data = data + read
                     if data:
                         bootlog += data