linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kbuild: fix ld-version.sh to not be affected by locale
@ 2021-03-12 19:38 Masahiro Yamada
  2021-03-12 19:43 ` Nick Desaulniers
  2021-03-12 19:49 ` Nathan Chancellor
  0 siblings, 2 replies; 3+ messages in thread
From: Masahiro Yamada @ 2021-03-12 19:38 UTC (permalink / raw)
  To: linux-kbuild
  Cc: Andy Shevchenko, Masahiro Yamada, Bernhard Rosenkränzer,
	Nathan Chancellor, Nick Desaulniers, Thomas Bogendoerfer,
	linux-kernel

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.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=212105
Reported-by: Marco Scardovi
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/ld-version.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/ld-version.sh b/scripts/ld-version.sh
index 30debf78aa09..1bf3aadde9de 100755
--- a/scripts/ld-version.sh
+++ b/scripts/ld-version.sh
@@ -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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] kbuild: fix ld-version.sh to not be affected by locale
  2021-03-12 19:38 [PATCH] kbuild: fix ld-version.sh to not be affected by locale Masahiro Yamada
@ 2021-03-12 19:43 ` Nick Desaulniers
  2021-03-12 19:49 ` Nathan Chancellor
  1 sibling, 0 replies; 3+ messages in thread
From: Nick Desaulniers @ 2021-03-12 19:43 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Linux Kbuild mailing list, Andy Shevchenko,
	Bernhard Rosenkränzer, Nathan Chancellor,
	Thomas Bogendoerfer, LKML

On Fri, Mar 12, 2021 at 11:38 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> 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.
>
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=212105
> Reported-by: Marco Scardovi
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

Recensito-Da: Nick Desaulniers <ndesaulniers@google.com>

In realtà non parlo italiano, ma so come usare Google Translate.


> ---
>
>  scripts/ld-version.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/ld-version.sh b/scripts/ld-version.sh
> index 30debf78aa09..1bf3aadde9de 100755
> --- a/scripts/ld-version.sh
> +++ b/scripts/ld-version.sh
> @@ -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
>


-- 
Thanks,
~Nick Desaulniers

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] kbuild: fix ld-version.sh to not be affected by locale
  2021-03-12 19:38 [PATCH] kbuild: fix ld-version.sh to not be affected by locale Masahiro Yamada
  2021-03-12 19:43 ` Nick Desaulniers
@ 2021-03-12 19:49 ` Nathan Chancellor
  1 sibling, 0 replies; 3+ messages in thread
From: Nathan Chancellor @ 2021-03-12 19:49 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: linux-kbuild, Andy Shevchenko, Bernhard Rosenkränzer,
	Nick Desaulniers, Thomas Bogendoerfer, linux-kernel

On Sat, Mar 13, 2021 at 04:38:14AM +0900, Masahiro Yamada wrote:
> 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.
> 
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=212105
> Reported-by: Marco Scardovi
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

LGTM, this is Debian's recommendation as well:
https://wiki.debian.org/Locale

Reviewed-by: Nathan Chancellor <nathan@kernel.org>

> ---
> 
>  scripts/ld-version.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/ld-version.sh b/scripts/ld-version.sh
> index 30debf78aa09..1bf3aadde9de 100755
> --- a/scripts/ld-version.sh
> +++ b/scripts/ld-version.sh
> @@ -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
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-12 19:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-12 19:38 [PATCH] kbuild: fix ld-version.sh to not be affected by locale Masahiro Yamada
2021-03-12 19:43 ` Nick Desaulniers
2021-03-12 19:49 ` Nathan Chancellor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).