]> xenbits.xensource.com Git - unikraft/unikraft.git/commitdiff
support/scripts: Fix Python ascii codec can't decode byte
authorbokket <3100563328@qq.com>
Wed, 8 Mar 2023 01:21:02 +0000 (09:21 +0800)
committerUnikraft <monkey@unikraft.io>
Wed, 3 May 2023 06:18:53 +0000 (06:18 +0000)
The output of objdump can't be decoded using only the ASCII
encoding on some system languages. Change it to utf-8 to be
more permissive.

Signed-off-by: bokket <3100563328@qq.com>
Signed-off-by: Florin Postolache <florin.postolache.of@gmail.com>
Reviewed-by: Alex Apostolescu <alexx.apostolescu@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #873

support/scripts/mkbootinfo.py

index cfc5cd076253c7a25f8f341b019b65d41eb22752..984b3fe6997caafe303a4c8d963b44b78aaaa77f 100755 (executable)
@@ -64,7 +64,7 @@ def main():
     # to create a binary blob that has exactly this size so we can replace it
     # in the binary.
     out = subprocess.check_output(["objdump", "-h", opt.kernel])
-    match = re.findall(SECINFO_EXP, out.decode('ASCII'), re.MULTILINE)
+    match = re.findall(SECINFO_EXP, out.decode('utf-8'), re.MULTILINE)
 
     if len(match) != 1:
         raise Exception(".uk_bootinfo section not found")
@@ -73,7 +73,7 @@ def main():
 
     # Retrieve info about ELF segments in unikernel
     out = subprocess.check_output(["objdump", "-p", opt.kernel])
-    phdrs = re.findall(PHDRS_EXP, out.decode('ASCII'), re.MULTILINE)
+    phdrs = re.findall(PHDRS_EXP, out.decode('utf-8'), re.MULTILINE)
 
     # The boot info is a struct ukplat_bootinfo
     # (see plat/common/include/uk/plat/common/bootinfo.h) followed by a list of