It has been discovered that Python versions below 3.7 may incorrectly detect the encoding of text files. If the system encoding is not UTF-8, then when building ovs with Python versions below 3.7, the ’24:checkpatch - AUTHORS.rst existence’ test may fail with the error ’UnicodeDecodeError: 'ascii' codec can't decode…’.
Reproduced in an environment with the environment variable LC_CPTYPE = C, openvsitch 3.3.5, Python 3.6. Not relevant when using Python version 3.7 or higher. Starting with this version, the locale is converted to UTF-8 regardless of the value of environment variables for Unix. Starting from 3.15 UTF-8 mode is default for all platforms. Signed-off-by: Ivan Burnin <iburnin@k2.cloud> --- utilities/checkpatch.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/utilities/checkpatch.py b/utilities/checkpatch.py index 28d0977eb..460bc4fa0 100755 --- a/utilities/checkpatch.py +++ b/utilities/checkpatch.py @@ -841,7 +841,9 @@ def do_authors_exist(authors): missing_authors = [] try: - with open(get_top_directory() + "/AUTHORS.rst", "r") as file: + with open( + get_top_directory() + "/AUTHORS.rst", "r", encoding="utf-8" + ) as file: file_content = file.read() for author in authors: m = re.search(r'<(.*?)>', author) -- 2.47.1 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev