From fa83e3a81ddb2170a0d7b0d86b94641a80d026ee Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Fri, 24 Oct 2025 17:42:00 +0200 Subject: [PATCH] lint: Do not allow locale dependent shell scripts Bash is discouraged, and there was never a need to write locale dependent Bash. So remove the option and clarify that the LC_ALL settings enable UTF-8 mode in Python. --- test/lint/lint-shell-locale.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/test/lint/lint-shell-locale.py b/test/lint/lint-shell-locale.py index 309c426374f..59515e7888d 100755 --- a/test/lint/lint-shell-locale.py +++ b/test/lint/lint-shell-locale.py @@ -1,22 +1,19 @@ #!/usr/bin/env python3 # -# Copyright (c) 2018-2022 The Bitcoin Core developers +# Copyright (c) 2018-present The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """ -Make sure all shell scripts are: -a.) explicitly opt out of locale dependence using - "export LC_ALL=C" or "export LC_ALL=C.UTF-8", or -b.) explicitly opt in to locale dependence using the annotation below. +Make sure all shell scripts explicitly opt out of locale dependence using +"export LC_ALL=C" or "export LC_ALL=C.UTF-8", which also enables UTF-8 mode in +Python. See: https://docs.python.org/3/library/os.html#python-utf-8-mode """ import subprocess import sys import re -OPT_IN_LINE = '# This script is intentionally locale dependent by not setting \"export LC_ALL=C\"' - OPT_OUT_LINES = [ 'export LC_ALL=C', 'export LC_ALL=C.UTF-8', @@ -47,9 +44,6 @@ def main(): with open(file_path, 'r', encoding='utf-8') as file_obj: contents = file_obj.read() - if OPT_IN_LINE in contents: - continue - non_comment_pattern = re.compile(r'^\s*((?!#).+)$', re.MULTILINE) non_comment_lines = re.findall(non_comment_pattern, contents) if not non_comment_lines: