Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

kbuild: replace LANG=C with LC_ALL=C

LANG gives a weak default to each LC_* in case it is not explicitly
defined. LC_ALL, if set, overrides all other LC_* variables.

LANG < LC_CTYPE, LC_COLLATE, LC_MONETARY, LC_NUMERIC, ... < LC_ALL

This is why documentation such as [1] suggests to set LC_ALL in build
scripts to get the deterministic result.

LANG=C is not strong enough to override LC_* that may be set by end
users.

[1]: https://reproducible-builds.org/docs/locales/

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
Reviewed-by: Matthias Maennich <maennich@google.com>
Acked-by: Matthieu Baerts <matthieu.baerts@tessares.net> (mptcp)
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

+7 -7
+1 -1
arch/powerpc/boot/wrapper
··· 191 191 kernel=vmlinux 192 192 fi 193 193 194 - LANG=C elfformat="`${CROSS}objdump -p "$kernel" | grep 'file format' | awk '{print $4}'`" 194 + LC_ALL=C elfformat="`${CROSS}objdump -p "$kernel" | grep 'file format' | awk '{print $4}'`" 195 195 case "$elfformat" in 196 196 elf64-powerpcle) format=elf64lppc ;; 197 197 elf64-powerpc) format=elf32ppc ;;
+1 -1
scripts/nsdeps
··· 44 44 for source_file in $mod_source_files; do 45 45 sed '/MODULE_IMPORT_NS/Q' $source_file > ${source_file}.tmp 46 46 offset=$(wc -l ${source_file}.tmp | awk '{print $1;}') 47 - cat $source_file | grep MODULE_IMPORT_NS | LANG=C sort -u >> ${source_file}.tmp 47 + cat $source_file | grep MODULE_IMPORT_NS | LC_ALL=C sort -u >> ${source_file}.tmp 48 48 tail -n +$((offset +1)) ${source_file} | grep -v MODULE_IMPORT_NS >> ${source_file}.tmp 49 49 if ! diff -q ${source_file} ${source_file}.tmp; then 50 50 mv ${source_file}.tmp ${source_file}
+1 -1
scripts/recordmcount.pl
··· 497 497 # 498 498 # Step 2: find the sections and mcount call sites 499 499 # 500 - open(IN, "LANG=C $objdump -hdr $inputfile|") || die "error running $objdump"; 500 + open(IN, "LC_ALL=C $objdump -hdr $inputfile|") || die "error running $objdump"; 501 501 502 502 my $text; 503 503
+1 -1
scripts/setlocalversion
··· 126 126 fi 127 127 128 128 # Check for svn and a svn repo. 129 - if rev=$(LANG= LC_ALL= LC_MESSAGES=C svn info 2>/dev/null | grep '^Last Changed Rev'); then 129 + if rev=$(LC_ALL=C svn info 2>/dev/null | grep '^Last Changed Rev'); then 130 130 rev=$(echo $rev | awk '{print $NF}') 131 131 printf -- '-svn%s' "$rev" 132 132
+1 -1
scripts/tags.sh
··· 326 326 327 327 # Remove structure forward declarations. 328 328 if [ -n "$remove_structs" ]; then 329 - LANG=C sed -i -e '/^\([a-zA-Z_][a-zA-Z0-9_]*\)\t.*\t\/\^struct \1;.*\$\/;"\tx$/d' $1 329 + LC_ALL=C sed -i -e '/^\([a-zA-Z_][a-zA-Z0-9_]*\)\t.*\t\/\^struct \1;.*\$\/;"\tx$/d' $1 330 330 fi
+1 -1
tools/testing/selftests/net/mptcp/mptcp_connect.sh
··· 274 274 ip netns exec ${disabled_ns} sysctl -q net.mptcp.enabled=0 275 275 276 276 local err=0 277 - LANG=C ip netns exec ${disabled_ns} ./mptcp_connect -p 10000 -s MPTCP 127.0.0.1 < "$cin" 2>&1 | \ 277 + LC_ALL=C ip netns exec ${disabled_ns} ./mptcp_connect -p 10000 -s MPTCP 127.0.0.1 < "$cin" 2>&1 | \ 278 278 grep -q "^socket: Protocol not available$" && err=1 279 279 ip netns delete ${disabled_ns} 280 280
+1 -1
usr/gen_initramfs.sh
··· 147 147 header "$1" 148 148 149 149 srcdir=$(echo "$1" | sed -e 's://*:/:g') 150 - dirlist=$(find "${srcdir}" -printf "%p %m %U %G\n" | LANG=C sort) 150 + dirlist=$(find "${srcdir}" -printf "%p %m %U %G\n" | LC_ALL=C sort) 151 151 152 152 # If $dirlist is only one line, then the directory is empty 153 153 if [ "$(echo "${dirlist}" | wc -l)" -gt 1 ]; then