Commit 77a88274 authored by Masahiro Yamada's avatar Masahiro Yamada
Browse files

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: default avatarMasahiro Yamada <masahiroy@kernel.org>
Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
Reviewed-by: default avatarMatthias Maennich <maennich@google.com>
Acked-by: Matthieu Baerts <matthieu.baerts@tessares.net> (mptcp)
Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 885480b0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -191,7 +191,7 @@ if [ -z "$kernel" ]; then
    kernel=vmlinux
fi

LANG=C elfformat="`${CROSS}objdump -p "$kernel" | grep 'file format' | awk '{print $4}'`"
LC_ALL=C elfformat="`${CROSS}objdump -p "$kernel" | grep 'file format' | awk '{print $4}'`"
case "$elfformat" in
    elf64-powerpcle)	format=elf64lppc	;;
    elf64-powerpc)	format=elf32ppc	;;
+1 −1
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@ generate_deps() {
		for source_file in $mod_source_files; do
			sed '/MODULE_IMPORT_NS/Q' $source_file > ${source_file}.tmp
			offset=$(wc -l ${source_file}.tmp | awk '{print $1;}')
			cat $source_file | grep MODULE_IMPORT_NS | LANG=C sort -u >> ${source_file}.tmp
			cat $source_file | grep MODULE_IMPORT_NS | LC_ALL=C sort -u >> ${source_file}.tmp
			tail -n +$((offset +1)) ${source_file} | grep -v MODULE_IMPORT_NS >> ${source_file}.tmp
			if ! diff -q ${source_file} ${source_file}.tmp; then
				mv ${source_file}.tmp ${source_file}
+1 −1
Original line number Diff line number Diff line
@@ -497,7 +497,7 @@ sub update_funcs
#
# Step 2: find the sections and mcount call sites
#
open(IN, "LANG=C $objdump -hdr $inputfile|") || die "error running $objdump";
open(IN, "LC_ALL=C $objdump -hdr $inputfile|") || die "error running $objdump";

my $text;

+1 −1
Original line number Diff line number Diff line
@@ -126,7 +126,7 @@ scm_version()
	fi

	# Check for svn and a svn repo.
	if rev=$(LANG= LC_ALL= LC_MESSAGES=C svn info 2>/dev/null | grep '^Last Changed Rev'); then
	if rev=$(LC_ALL=C svn info 2>/dev/null | grep '^Last Changed Rev'); then
		rev=$(echo $rev | awk '{print $NF}')
		printf -- '-svn%s' "$rev"

+1 −1
Original line number Diff line number Diff line
@@ -326,5 +326,5 @@ esac

# Remove structure forward declarations.
if [ -n "$remove_structs" ]; then
    LANG=C sed -i -e '/^\([a-zA-Z_][a-zA-Z0-9_]*\)\t.*\t\/\^struct \1;.*\$\/;"\tx$/d' $1
    LC_ALL=C sed -i -e '/^\([a-zA-Z_][a-zA-Z0-9_]*\)\t.*\t\/\^struct \1;.*\$\/;"\tx$/d' $1
fi
Loading