diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2016-06-29 15:12:03 +1200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-07-08 09:57:24 +0100 |
commit | 75f1a0ed422669734081f394187c28ef0258dfc2 (patch) | |
tree | dbb026543f557ec3c391d41fc03be9b72196dbe7 /scripts/lib/recipetool/create_npm.py | |
parent | 74c5cd0c2c98c0fb80c834b514afacb598ad7073 (diff) | |
download | poky-75f1a0ed422669734081f394187c28ef0258dfc2.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].
(From OE-Core rev: 50fcd9d1b9a20d49bc873467a82a071f2f2f8b5a)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/recipetool/create_npm.py')
-rw-r--r-- | scripts/lib/recipetool/create_npm.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/lib/recipetool/create_npm.py b/scripts/lib/recipetool/create_npm.py index fcc0172af8..e5aaa60bf8 100644 --- a/scripts/lib/recipetool/create_npm.py +++ b/scripts/lib/recipetool/create_npm.py | |||
@@ -92,7 +92,7 @@ class NpmRecipeHandler(RecipeHandler): | |||
92 | return False | 92 | return False |
93 | 93 | ||
94 | def read_package_json(fn): | 94 | def read_package_json(fn): |
95 | with open(fn, 'r') as f: | 95 | with open(fn, 'r', errors='surrogateescape') as f: |
96 | return json.loads(f.read()) | 96 | return json.loads(f.read()) |
97 | 97 | ||
98 | files = RecipeHandler.checkfiles(srctree, ['package.json']) | 98 | files = RecipeHandler.checkfiles(srctree, ['package.json']) |