Skip to content

Commit 77a8827

Browse files
committedMay 1, 2021
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 <[email protected]> Acked-by: Michael Ellerman <[email protected]> (powerpc) Reviewed-by: Matthias Maennich <[email protected]> Acked-by: Matthieu Baerts <[email protected]> (mptcp) Reviewed-by: Greg Kroah-Hartman <[email protected]>
1 parent 885480b commit 77a8827

File tree

7 files changed

+7
-7
lines changed

7 files changed

+7
-7
lines changed
 

‎arch/powerpc/boot/wrapper

+1-1
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ if [ -z "$kernel" ]; then
191191
kernel=vmlinux
192192
fi
193193

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}'`"
195195
case "$elfformat" in
196196
elf64-powerpcle) format=elf64lppc ;;
197197
elf64-powerpc) format=elf32ppc ;;

‎scripts/nsdeps

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ generate_deps() {
4444
for source_file in $mod_source_files; do
4545
sed '/MODULE_IMPORT_NS/Q' $source_file > ${source_file}.tmp
4646
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
4848
tail -n +$((offset +1)) ${source_file} | grep -v MODULE_IMPORT_NS >> ${source_file}.tmp
4949
if ! diff -q ${source_file} ${source_file}.tmp; then
5050
mv ${source_file}.tmp ${source_file}

‎scripts/recordmcount.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ sub update_funcs
497497
#
498498
# Step 2: find the sections and mcount call sites
499499
#
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";
501501

502502
my $text;
503503

‎scripts/setlocalversion

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ scm_version()
126126
fi
127127

128128
# 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
130130
rev=$(echo $rev | awk '{print $NF}')
131131
printf -- '-svn%s' "$rev"
132132

‎scripts/tags.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -326,5 +326,5 @@ esac
326326

327327
# Remove structure forward declarations.
328328
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
330330
fi

‎tools/testing/selftests/net/mptcp/mptcp_connect.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ check_mptcp_disabled()
274274
ip netns exec ${disabled_ns} sysctl -q net.mptcp.enabled=0
275275

276276
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 | \
278278
grep -q "^socket: Protocol not available$" && err=1
279279
ip netns delete ${disabled_ns}
280280

‎usr/gen_initramfs.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ dir_filelist() {
147147
header "$1"
148148

149149
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)
151151

152152
# If $dirlist is only one line, then the directory is empty
153153
if [ "$(echo "${dirlist}" | wc -l)" -gt 1 ]; then

0 commit comments

Comments
 (0)
Please sign in to comment.