]> code.ossystems Code Review - openembedded-core.git/commitdiff
insane.bbclass:buildpaths: open() file with 'rb'
authorRobert Yang <liezhi.yang@windriver.com>
Tue, 1 Nov 2016 12:44:46 +0000 (05:44 -0700)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 6 Nov 2016 23:35:17 +0000 (23:35 +0000)
open() is default to 'rt' which may cause decoding errors when open
binary file:
$ bitbake xcursor-transparent-theme
[snip]
Exception: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfd in position 18: invalid start byte
[snip]

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/classes/insane.bbclass

index 1d73778255a6227c31ba599db291977bc18a95e3..a5c93f33ff53872e5120c530fddd8bdaa4097f48 100644 (file)
@@ -647,8 +647,8 @@ def package_qa_check_buildpaths(path, name, d, elf, messages):
         return
 
     tmpdir = d.getVar('TMPDIR', True)
-    with open(path) as f:
-        file_content = f.read()
+    with open(path, 'rb') as f:
+        file_content = f.read().decode('utf-8', errors='ignore')
         if tmpdir in file_content:
             package_qa_add_message(messages, "buildpaths", "File %s in package contained reference to tmpdir" % package_qa_clean_path(path,d))