Skip to contentSkip to conversation

lib/bb/build.py: decode the command as UTF-8

PATCH In review Ross Burton 2 participants 2 messages Jul 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib/bb/build.py: decode the command as UTF-8

The messaging FIFO is UTF-8, so decode the command as UTF-8 as well as the value as otherwise "bberror" != b("bberror") and none of the messages from shell functions are ever displayed.

Also add an else to the command parser so unhandled commands are noticed.

---
 bitbake/lib/bb/build.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
bitbake/lib/bb/build.py +3 -2
index 4f01d66..7c47680 100644
@@ -389,7 +389,7 @@ exit $ret
         lines = data.split(b'\0')
         for line in lines:
             splitval = line.split(b' ', 1)
-            cmd = splitval[0]
+            cmd = splitval[0].decode("utf-8")
             if len(splitval) > 1:
                 value = splitval[1].decode("utf-8")
             else:
@@ -413,7 +413,8 @@ exit $ret
                 level = int(splitval[0])
                 value = splitval[1]
                 bb.debug(level, value)
-
+            else:
+                bb.warn("Unrecognised command '%s' on FIFO" % cmd)
     tempdir = d.getVar('T', True)
     fifopath = os.path.join(tempdir, 'fifo.%s' % os.getpid())
     if os.path.exists(fifopath):
Signature · 1 line
2.8.1
#1 lore raw
Quoted 5 lines · On Fri, 15 Jul 2016 11:27:22 Ross Burton wrote:

The messaging FIFO is UTF-8, so decode the command as UTF-8 as well as the value as otherwise "bberror" != b("bberror") and none of the messages from shell functions are ever displayed.

Also add an else to the command parser so unhandled commands are noticed.

Thanks. Ideally this should be marked as "Fixes [YOCTO #9947]" when it gets merged.

Cheers,
Paul

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre