From 94620bdb0b03c3bf352c1a22fa85249c0fb49136 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Sun, 1 Oct 2017 23:47:43 +0300 Subject: [PATCH] scripts: gen_syscalls: Use explicit encoding when reading headers In Python, if open() doesn't specify "encoding" parameter, locale.getpreferredencoding(False) will be used as the default, as explained in https://docs.python.org/3/library/functions.html#open , which may differ from system to system. So, explicitly specify "encoding" param in open() call. Also, fix a typo in a comment. Signed-off-by: Paul Sokolovsky --- scripts/gen_syscalls.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/gen_syscalls.py b/scripts/gen_syscalls.py index eeb4ba8633f..e5392fc86ff 100755 --- a/scripts/gen_syscalls.py +++ b/scripts/gen_syscalls.py @@ -94,7 +94,7 @@ def analyze_headers(base_path): if not fn.endswith(".h") or path.endswith("toolchain/common.h"): continue - with open(path, "r") as fp: + with open(path, "r", encoding="utf-8") as fp: try: result = [analyze_fn(mo.groups(), fn) for mo in api_regex.finditer(fp.read())] @@ -108,8 +108,8 @@ def analyze_headers(base_path): table_template = """/* auto-generated by gen_syscalls.py, don't edit */ -/* Weak handler functions that get replaced by the real ones unles a system - * call is not implemented due to kernel configuration +/* Weak handler functions that get replaced by the real ones unless a system + * call is not implemented due to kernel configuration. */ %s