On Fri, Aug 22, 2025 at 2:10 AM Ivan Burnin <[email protected]> wrote:

> 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  - PEP 538: legacy C
> local coercion and PEP 540: Forced   UTF-8 Runtime Mode
>
> Signed-off-by: Ivan Burnin <[email protected]>
> ---
>

Hello Ivan,

thank you for the patch. We usually consume updates for
checkpatch.py from ovs [0]. I see there is an ovs counterpart,
would you mind posting a patch similar to [0] when the
changes get accepted into ovs?

[0] https://github.com/ovn-org/ovn/commit/0ce21f2a

Thanks,
Ales

 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
> [email protected]
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to