kbuild: fix ld-version.sh to not be affected by locale
PATCH 1/1 kbuild: fix ld-version.sh to not be affected by locale
ld-version.sh checks the output from $(LD) --version, but it has a problem on some locales.
For example, in Italian:
$ LC_MESSAGES=it_IT.UTF-8 ld --version | head -n 1 ld di GNU (GNU Binutils for Debian) 2.35.2
This makes ld-version.sh fail because it expects "GNU ld" for the BFD linker case.
Add LC_ALL=C to override the user's locale.
BTW, setting LC_MESSAGES=C (or LANG=C) is not enough because it is ineffective if LC_ALL is set on the user's environment.
---
scripts/ld-version.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/ld-version.sh +1 -1
@@ -29,7 +29,7 @@ orig_args="$@" # Get the first line of the --version output. IFS=' ' -set -- $("$@" --version) +set -- $(LC_ALL=C "$@" --version) # Split the line on spaces. IFS=' '
Signature · 1 line
2.27.0
Quoted 12 lines · Masahiro Yamada
ld-version.shchecks the output from $(LD) --version, but it has a problem on some locales.For example, in Italian:
$ LC_MESSAGES=it_IT.UTF-8 ld --version | head -n 1 ld di GNU (GNU Binutils for Debian) 2.35.2This makes
ld-version.shfail because it expects "GNU ld" for the BFD linker case.
Quoted 8 lines
Add LC_ALL=C to override the user's locale.
BTW, setting LC_MESSAGES=C (or LANG=C) is not enough because it is ineffective if
LC_ALLis set on the user's environment.Reported-by Marco ScardoviSigned-off-by Masahiro Yamada <[email protected]>
Recensito-Da: Nick Desaulniers <[email protected]>
In realtà non parlo italiano, ma so come usare Google Translate.
Quoted 21 lines
---
scripts/ld-version.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)scripts/ld-version.sh +1
-2@@ -29,7 +29,7 @@ orig_args="$@" # Get the first line of the --version output. IFS=' ' -set -- $("$@" --version) +set -- $(LC_ALL=C "$@" --version) # Split the line on spaces. IFS=' ' --2.27.0
Signature · 2 lines
Thanks, ~Nick Desaulniers
Quoted 11 lines · Masahiro Yamada
ld-version.shchecks the output from $(LD) --version, but it has a problem on some locales.For example, in Italian:
$ LC_MESSAGES=it_IT.UTF-8 ld --version | head -n 1 ld di GNU (GNU Binutils for Debian) 2.35.2This makes
ld-version.shfail because it expects "GNU ld" for the BFD linker case.
Quoted 8 lines
Add LC_ALL=C to override the user's locale.
BTW, setting LC_MESSAGES=C (or LANG=C) is not enough because it is ineffective if
LC_ALLis set on the user's environment.Reported-by Marco ScardoviSigned-off-by Masahiro Yamada <[email protected]>
LGTM, this is Debian's recommendation as well:
https://wiki.debian.org/Locale
Quoted 21 lines
---
scripts/ld-version.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)scripts/ld-version.sh +1
-1@@ -29,7 +29,7 @@ orig_args="$@" # Get the first line of the --version output. IFS=' ' -set -- $("$@" --version) +set -- $(LC_ALL=C "$@" --version) # Split the line on spaces. IFS=' 'Signature · 1 line
2.27.0