[oe-commits] [openembedded-core] 15/26: license: don't assume source files are UTF-8

git at git.openembedded.org git at git.openembedded.org
Thu Mar 9 01:23:20 UTC 2017


This is an automated email from the git hooks/post-receive script.

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

commit 30772622d4f931650a22e4d71fdffdbec09c4136
Author: Ross Burton <ross.burton at intel.com>
AuthorDate: Wed Mar 8 14:30:13 2017 +0000

    license: don't assume source files are UTF-8
    
    We can't assume that source files are entirely UTF-8, so when copying the
    license blocks open the file as binary instead of text.
    
    [ YOCTO #11135 ]
    
    Signed-off-by: Ross Burton <ross.burton at intel.com>
---
 meta/classes/license.bbclass | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass
index 0ff6560..81458e7 100644
--- a/meta/classes/license.bbclass
+++ b/meta/classes/license.bbclass
@@ -386,9 +386,9 @@ def copy_license_files(lic_files_paths, destdir):
                 if begin_idx is None and end_idx is None:
                     shutil.copyfile(src, dst)
                 else:
-                    with open(src, 'r') as src_f:
-                        with open(dst, 'w') as dst_f:
-                            dst_f.write(''.join(src_f.readlines()[begin_idx:end_idx]))
+                    with open(src, 'rb') as src_f:
+                        with open(dst, 'wb') as dst_f:
+                            dst_f.write(b''.join(src_f.readlines()[begin_idx:end_idx]))
 
         except Exception as e:
             bb.warn("Could not copy license file %s to %s: %s" % (src, dst, e))

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


More information about the Openembedded-commits mailing list