scripts/mkcompile_h: move LC_ALL=C to '$LD -v'
authorMasahiro Yamada <masahiroy@kernel.org>
Sun, 28 Aug 2022 02:39:55 +0000 (11:39 +0900)
committerMasahiro Yamada <masahiroy@kernel.org>
Wed, 28 Sep 2022 19:40:15 +0000 (04:40 +0900)
Minimize the scope of LC_ALL=C like before commit 87c94bfb8ad3 ("kbuild:
override build timestamp & version").

Give LC_ALL=C to '$LD -v' to get the consistent version output, as commit
bcbcf50f5218 ("kbuild: fix ld-version.sh to not be affected by locale")
mentioned the LD version is affected by locale.

While I was here, I merged two sed invocations.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
scripts/mkcompile_h

index f1a820d..b76ccbb 100755 (executable)
@@ -8,10 +8,6 @@ LD=$3
 # Do not expand names
 set -f
 
-# Fix the language to get consistent output
-LC_ALL=C
-export LC_ALL
-
 if test -z "$KBUILD_BUILD_USER"; then
        LINUX_COMPILE_BY=$(whoami | sed 's/\\/\\\\/')
 else
@@ -23,8 +19,8 @@ else
        LINUX_COMPILE_HOST=$KBUILD_BUILD_HOST
 fi
 
-LD_VERSION=$($LD -v | head -n1 | sed 's/(compatible with [^)]*)//' \
-             | sed 's/[[:space:]]*$//')
+LD_VERSION=$(LC_ALL=C $LD -v | head -n1 |
+               sed -e 's/(compatible with [^)]*)//' -e 's/[[:space:]]*$//')
 
 cat <<EOF
 #define UTS_MACHINE            "${UTS_MACHINE}"