diff options
author | Harald Welte <laforge@osmocom.org> | 2019-12-17 13:17:54 +0100 |
---|---|---|
committer | Harald Welte <laforge@osmocom.org> | 2019-12-17 13:19:12 +0100 |
commit | 8d0605c4fb2527c376718800a5348b0da77db766 (patch) | |
tree | 767204775473158a70c1558fab8178fe06a87f30 /scripts | |
parent | bcd5a7b92756237c69129c7ec186c965c7ce5539 (diff) |
verify_*.py: Ignore UTF-8 decoding errors
Some of our source files are inherited from other sources, particularly
for microcontroller firmware projects. We cannot assume they're all
clean UTF-8. Let's ignore any decoder errors when verifying log
statements and value_string arrays.
Closes: OS#4334
Change-Id: I1e19f4bc6bee46481c6ea743e8334bd4485909be
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/verify_log_statements.py | 2 | ||||
-rwxr-xr-x | scripts/verify_value_string_arrays_are_terminated.py | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/scripts/verify_log_statements.py b/scripts/verify_log_statements.py index 9a9cd1b..064df73 100755 --- a/scripts/verify_log_statements.py +++ b/scripts/verify_log_statements.py @@ -66,7 +66,7 @@ def check_file(f): try: errors_found = [] - file_content = codecs.open(f, "r", "utf-8").read() + file_content = codecs.open(f, "r", "utf-8", errors='ignore').read() for log in log_statement_re.finditer(file_content): quoted = log.group(2) diff --git a/scripts/verify_value_string_arrays_are_terminated.py b/scripts/verify_value_string_arrays_are_terminated.py index 9f0ad82..f6dc545 100755 --- a/scripts/verify_value_string_arrays_are_terminated.py +++ b/scripts/verify_value_string_arrays_are_terminated.py @@ -27,7 +27,7 @@ def check_file(f): global errors_found if not (f.endswith('.h') or f.endswith('.c') or f.endswith('.cpp')): return - arrays = value_string_array_re.findall(codecs.open(f, "r", "utf-8").read()) + arrays = value_string_array_re.findall(codecs.open(f, "r", "utf-8", errors='ignore').read()) for array_def, name in arrays: if not terminator_re.search(array_def): print('ERROR: file contains unterminated value_string %r: %r' |