[OE-core] [PATCH 1/1] insane.bbclass:buildpaths: open() file with 'rb'
Robert Yang
liezhi.yang at windriver.com
Tue Nov 1 12:44:46 UTC 2016
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 at windriver.com>
---
meta/classes/insane.bbclass | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index 1d73778..a5c93f3 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -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))
--
2.9.0
More information about the Openembedded-core
mailing list