From 50fcd9d1b9a20d49bc873467a82a071f2f2f8b5a Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Wed, 29 Jun 2016 15:12:03 +1200 Subject: 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 Signed-off-by: Ross Burton --- scripts/lib/recipetool/create_kernel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts/lib/recipetool/create_kernel.py') diff --git a/scripts/lib/recipetool/create_kernel.py b/scripts/lib/recipetool/create_kernel.py index c6e86bd2b9..7dac59fd03 100644 --- a/scripts/lib/recipetool/create_kernel.py +++ b/scripts/lib/recipetool/create_kernel.py @@ -59,7 +59,7 @@ class KernelRecipeHandler(RecipeHandler): kpatchlevel = -1 ksublevel = -1 kextraversion = '' - with open(makefile, 'r') as f: + with open(makefile, 'r', errors='surrogateescape') as f: for i, line in enumerate(f): if i > 10: break -- cgit 1.2.3-korg