diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2016-06-27 09:22:11 +1200 |
---|---|---|
committer | Paul Eggleton <paul.eggleton@linux.intel.com> | 2016-06-29 15:11:21 +1200 |
commit | 7c749720e8f23828d5312b040be0b0451f2fd009 (patch) | |
tree | 7d85ed5b4d53166fdd2d7649e4e37a9d010a4d7c /scripts/lib/recipetool/create_kmod.py | |
parent | 646c366c2566bd8dd6f73681cea9f5b021589a56 (diff) | |
download | openembedded-core-contrib-7c749720e8f23828d5312b040be0b0451f2fd009.tar.gz |
recipetool: create: avoid decoding errors with Python 3
We're opening source files with the default encoding (utf-8) but we
can't necessarily be sure that they are UTF-8 clean - for example,
recipetool create ftp://mama.indstate.edu/linux/tree/tree-1.7.0.tgz
prior to this patch resulted in a UnicodeDecodeError. Use the
"surrogateescape" mode to avoid this.
Fixes [YOCTO #9822].
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Diffstat (limited to 'scripts/lib/recipetool/create_kmod.py')
-rw-r--r-- | scripts/lib/recipetool/create_kmod.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/scripts/lib/recipetool/create_kmod.py b/scripts/lib/recipetool/create_kmod.py index fe39edb288..7cf188db21 100644 --- a/scripts/lib/recipetool/create_kmod.py +++ b/scripts/lib/recipetool/create_kmod.py @@ -53,7 +53,7 @@ class KernelModuleRecipeHandler(RecipeHandler): break else: continue - with open(cfile, 'r') as f: + with open(cfile, 'r', errors='surrogateescape') as f: for line in f: if module_inc_re.match(line.strip()): is_module = True @@ -73,7 +73,7 @@ class KernelModuleRecipeHandler(RecipeHandler): in_install = False in_compile = False install_target = None - with open(makefile, 'r') as f: + with open(makefile, 'r', errors='surrogateescape') as f: for line in f: if line.startswith('install:'): if not install_lines: |