[oe-commits] [openembedded-core] 27/83: insane.bbclass:buildpaths: open() file with 'rb'

git at git.openembedded.org git at git.openembedded.org
Sun Nov 6 23:36:39 UTC 2016


rpurdie pushed a commit to branch master
in repository openembedded-core.

commit ddbab61f47efd9b4fde38ef8f0f3482c78abe37c
Author: Robert Yang <liezhi.yang at windriver.com>
AuthorDate: Tue Nov 1 05:44:46 2016 -0700

    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]
    
    Signed-off-by: Robert Yang <liezhi.yang at windriver.com>
    Signed-off-by: Ross Burton <ross.burton at intel.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))
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list