wafsamba/symbols: always split Popen output by bytes
authorJoe Guo <joeg@catalyst.net.nz>
Thu, 14 Feb 2019 22:23:17 +0000 (11:23 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 18 Feb 2019 08:25:21 +0000 (09:25 +0100)
In py3, `wafsamba.duplicate_symbols` test may fail:

    ...
    elfpipe = subprocess.Popen(['readelf', '--dynamic', binname], stdout=subprocess.PIPE).stdout
    ...

    File "./buildtools/wafsamba/symbols.py", line 153, in get_libs
        rpath.extend(m.group(1).split(":"))
    TypeError: a bytes-like object is required, not 'str'

Because Popen will always return bytestr even in py3, and ":" is a
unicode str in py3.  Change ":" to b":" to fix.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
buildtools/wafsamba/symbols.py

index 4eab8e4a059a428ca1c5e473c549bba7af905ad1..505c0bac7eac58fa487676ba3ff8b3321a189f09 100644 (file)
@@ -146,7 +146,8 @@ def get_libs(bld, binname):
             libs.add(m.group(1))
         m = re_rpath.search(line)
         if m:
-            rpath.extend(m.group(1).split(":"))
+            # output from Popen is always bytestr even in py3
+            rpath.extend(m.group(1).split(b":"))
 
     ret = set()
     for lib in libs: