Skip to contentSkip to conversation

insane.bbclass:buildpaths: open() file with 'rb'

PATCH New Robert Yang 1 participant 2 messages Nov 1, 2016

lore
Share & tools
lore
#0 lore raw

cover insane.bbclass:buildpaths: open() file with 'rb'

The following changes since commit 98c6ebf1e05158c689e01b785d32757847cdb10c:

oeqa/selftest/kernel.py: Add new file destined for kernel related tests (2016-11-01 10:05:40 +0000)

are available in the git repository at:

git://git.openembedded.org/openembedded-core-contrib rbt/bp
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=rbt/bp

Robert Yang (1):
insane.bbclass:buildpaths: open() file with 'rb'

 meta/classes/insane.bbclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.9.0
#1 lore raw

PATCH 1/1 insane.bbclass:buildpaths: open() file with 'rb'

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]
---
 meta/classes/insane.bbclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
meta/classes/insane.bbclass +2 -2
index 1d73778..a5c93f3 100644
@@ -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))
 
Signature · 1 line
2.9.0