Merge bitcoin/bitcoin#35778: scripted-diff: Use C.UTF-8 locale in all shell scripts
What changed, and why it matters
This commit simply changes every shell script in the project from using the plain 'C' locale to the 'C.UTF-8' locale, and updates the project's linter to enforce the new standard. It is a code-quality and consistency change, not a security fix. There is no indication it addresses any vulnerability or security incident.
No security action required. Treat as a normal code-quality/linting consistency change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit is a scripted diff that replaces ‘export LC_ALL=C’ with ‘export LC_ALL=C.UTF-8’ across 12 shell scripts and updates test/lint/lint-shell-locale.py to require the new locale string and to skip the libmultiprocess subtree. Using C.UTF-8 ensures UTF-8 support while remaining locale-independent, which can prevent subtle locale-related tooling issues but is not a direct security patch.
Changed components
ci/lint/01_install.shci/lint/06_script.shcmake/script/macos_zip.shcontrib/devtools/check-deps.shcontrib/devtools/gen-bitcoin-conf.shcontrib/macdeploy/detached-sig-create.shcontrib/qos/tc.shcontrib/verify-commits/gpg.shcontrib/windeploy/detached-sig-create.shsrc/qt/res/animation/makespinner.shtest/lint/commit-script-check.shtest/lint/git-subtree-check.shtest/lint/lint-shell-locale.pyInspect captured patch +16 / −17
### ci/lint/01_install.sh
@@ -4,7 +4,7 @@
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
-export LC_ALL=C
+export LC_ALL=C.UTF-8
set -o errexit -o pipefail -o xtrace
### ci/lint/06_script.sh
@@ -4,7 +4,7 @@
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
-export LC_ALL=C
+export LC_ALL=C.UTF-8
set -o errexit -o pipefail -o xtrace
### cmake/script/macos_zip.sh
@@ -3,7 +3,7 @@
# Distributed under the MIT software license, see the accompanying
# file COPYING or https://opensource.org/license/mit/.
-export LC_ALL=C
+export LC_ALL=C.UTF-8
if [ -n "$SOURCE_DATE_EPOCH" ]; then
find . -exec touch -d "@$SOURCE_DATE_EPOCH" {} +
### contrib/devtools/check-deps.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
-export LC_ALL=C
+export LC_ALL=C.UTF-8
set -Eeuo pipefail
# Declare paths to libraries
### contrib/devtools/gen-bitcoin-conf.sh
@@ -3,7 +3,7 @@
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
-export LC_ALL=C
+export LC_ALL=C.UTF-8
TOPDIR=${TOPDIR:-$(git rev-parse --show-toplevel)}
BUILDDIR=${BUILDDIR:-$TOPDIR/build}
BINDIR=${BINDIR:-$BUILDDIR/bin}
### contrib/macdeploy/detached-sig-create.sh
@@ -3,7 +3,7 @@
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
-export LC_ALL=C
+export LC_ALL=C.UTF-8
set -e
SIGNAPPLE=signapple
### contrib/qos/tc.sh
@@ -4,7 +4,7 @@
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
-export LC_ALL=C
+export LC_ALL=C.UTF-8
#network interface on which to limit traffic
IF="eth0"
#limit of the network interface in question
### contrib/verify-commits/gpg.sh
@@ -3,7 +3,7 @@
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
-export LC_ALL=C
+export LC_ALL=C.UTF-8
INPUT=$(cat /dev/stdin)
if [ "$BITCOIN_VERIFY_COMMITS_ALLOW_SHA1" = 1 ]; then
printf '%s\n' "$INPUT" | gpg --trust-model always "$@" 2>/dev/null
### contrib/windeploy/detached-sig-create.sh
@@ -3,7 +3,7 @@
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
-export LC_ALL=C
+export LC_ALL=C.UTF-8
if [ -z "$OSSLSIGNCODE" ]; then
OSSLSIGNCODE=osslsigncode
fi
### src/qt/res/animation/makespinner.sh
@@ -4,7 +4,7 @@
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
-export LC_ALL=C
+export LC_ALL=C.UTF-8
FRAMEDIR=$(dirname "$0")
for i in {0..35}
do
### test/lint/commit-script-check.sh
@@ -11,7 +11,7 @@
# The resulting script should exactly transform the previous commit into the current
# one. Any remaining diff signals an error.
-export LC_ALL=C
+export LC_ALL=C.UTF-8
if test -z "$1"; then
echo "Usage: $0 <commit>..."
exit 1
### test/lint/git-subtree-check.sh
@@ -3,7 +3,7 @@
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
-export LC_ALL=C
+export LC_ALL=C.UTF-8
check_remote=0
while getopts "?hr" opt; do
### test/lint/lint-shell-locale.py
@@ -5,8 +5,8 @@
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""
-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
+Make sure all shell scripts explicitly opt out of locale dependence
+using "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
"""
@@ -15,7 +15,6 @@
import re
OPT_OUT_LINES = [
- 'export LC_ALL=C',
'export LC_ALL=C.UTF-8',
]
@@ -38,7 +37,7 @@ def main():
exit_code = 0
shell_files = get_shell_files_list()
for file_path in shell_files:
- if re.search('src/(secp256k1|minisketch)/', file_path):
+ if re.search('src/(ipc/libmultiprocess|secp256k1|minisketch)/', file_path):
continue
with open(file_path, 'r') as file_obj:
@@ -51,7 +50,7 @@ def main():
first_non_comment_line = non_comment_lines[0]
if first_non_comment_line not in OPT_OUT_LINES:
- print(f'Missing "export LC_ALL=C" (to avoid locale dependence) as first non-comment non-empty line in {file_path}')
+ print(f'Missing "export LC_ALL=C.UTF-8" (to avoid locale dependence) as first non-comment non-empty line in {file_path}')
exit_code = 1
return sys.exit(exit_code)Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.