4e5dbe2
From aac29e679b7c336537e93ce7b07c59e6b1a534ff Mon Sep 17 00:00:00 2001
4e5dbe2
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
4e5dbe2
Date: Sun, 24 Apr 2022 15:47:21 +0200
4e5dbe2
Subject: [PATCH 03/21] Don't abort when the data in _wait_for_install_finish
4e5dbe2
 isn't valid utf-8
4e5dbe2
4e5dbe2
See https://www.scrye.com/wordpress/nirik/2022/04/21/another-tale-of-a-rawhide-compose-bug/ for context
4e5dbe2
4e5dbe2
Decoding arbitrary data that happens to be valid utf-8 almost all the time
4e5dbe2
for logging purposes sounds like a good idea, until it isn't.
4e5dbe2
This way, the debug log will contain the data even if it's not valid utf-8,
4e5dbe2
instead of aborting the process with a UnicodeDecodeError.
4e5dbe2
---
4e5dbe2
 oz/Guest.py | 2 +-
4e5dbe2
 1 file changed, 1 insertion(+), 1 deletion(-)
4e5dbe2
4e5dbe2
diff --git a/oz/Guest.py b/oz/Guest.py
4e5dbe2
index 9cc80a6..ae954b8 100644
4e5dbe2
--- a/oz/Guest.py
4e5dbe2
+++ b/oz/Guest.py
4e5dbe2
@@ -848,7 +848,7 @@ class Guest(object):
4e5dbe2
                     # is no guarantee that we will get the whole write in one go
4e5dbe2
                     data = self.sock.recv(65536)
4e5dbe2
                     if data:
4e5dbe2
-                        self.log.debug(data.decode('utf-8'))
4e5dbe2
+                        self.log.debug(data.decode('utf-8', errors='surrogateescape'))
4e5dbe2
                 except socket.timeout:
4e5dbe2
                     # the socket times out after 1 second.  We can just fall
4e5dbe2
                     # through to the below code because it is a noop.
4e5dbe2
-- 
4e5dbe2
2.43.0
4e5dbe2