[oe-commits] [openembedded-core] 106/122: qemurunner: Simplify binary data handling

git at git.openembedded.org git at git.openembedded.org
Mon Dec 4 17:26:24 UTC 2017


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

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

commit 20bc247316ab915465a4b1add6d09b48e07202ac
Author: Richard Purdie <richard.purdie at linuxfoundation.org>
AuthorDate: Tue Nov 21 11:42:54 2017 +0000

    qemurunner: Simplify binary data handling
    
    I have concerns that bad timing of the flow of data from the logger
    might corrupt the output due to the way binary strings are handled
    in qemurunner.
    
    This simplifies the code to do the same thing it did before but much
    more safely.
    
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
    (cherry picked from commit 1e87283e92a2765bb5d54d17138b208bc395953b)
    Signed-off-by: Armin Kuster <akuster808 at gmail.com>
---
 meta/lib/oeqa/utils/qemurunner.py | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py
index 82335d8..0631d43 100644
--- a/meta/lib/oeqa/utils/qemurunner.py
+++ b/meta/lib/oeqa/utils/qemurunner.py
@@ -275,7 +275,7 @@ class QemuRunner:
         reachedlogin = False
         stopread = False
         qemusock = None
-        bootlog = ''
+        bootlog = b''
         data = b''
         while time.time() < endtime and not stopread:
             try:
@@ -292,17 +292,13 @@ class QemuRunner:
                 else:
                     data = data + sock.recv(1024)
                     if data:
-                        try:
-                            data = data.decode("utf-8", errors="surrogateescape")
-                            bootlog += data
-                            data = b''
-                            if re.search(".* login:", bootlog):
-                                self.server_socket = qemusock
-                                stopread = True
-                                reachedlogin = True
-                                self.logger.debug("Reached login banner")
-                        except UnicodeDecodeError:
-                            continue
+                        bootlog += data
+                        data = b''
+                        if b' login:' in bootlog:
+                            self.server_socket = qemusock
+                            stopread = True
+                            reachedlogin = True
+                            self.logger.debug("Reached login banner")
                     else:
                         socklist.remove(sock)
                         sock.close()

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


More information about the Openembedded-commits mailing list