Re: [PATCH] detect-compiler: make detection independent of locale

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Michael J Gruber <git@xxxxxxxxx> writes:

> `detect-compiler` has accumulated a few compiler dependent workarounds
> lately for the more and more ubiquitious gcc12. This is intended to make
> CI set-ups work across tool-chain updates, but also help those
> developers who build with `DEVELOPER=1`.
>
> Alas, `detect-compiler` uses the locale dependent output of `$(CC) -v`
> to parse for the version string, which fails unless it literally
> contains ` version`.
>
> Use `LANG=C $(CC) -v` instead to grep for stable output.

I think this patch is a bit insufficient.

    $ LC_ALL=ja_JP.utf8 LANG=C gcc -v 2>&1 | head -n 1
    組み込み spec を使用しています。
    $ LC_ALL=C LANG=ja_JP.utf8 gcc -v 2>&1 | head -n 1
    Using built-in specs.

In theory overriding LC_ALL alone may be sufficient these days where
everybody seems to know about LC_*, but just out of habit, I would
recommend forcing both, i.e.

>  get_version_line() {
> -	$CC -v 2>&1 | grep ' version '
> +	LANG=C $CC -v 2>&1 | grep ' version '

this on top of the posted patch, which is what I'll squash in when
queuing this patch (no need to resend if you agree with the above
and unless you have other changes and improvements).

Thanks.

diff --git i/detect-compiler w/detect-compiler
index 473f3bd4fe..50087f5670 100755
--- i/detect-compiler
+++ w/detect-compiler
@@ -9,7 +9,7 @@ CC="$*"
 #
 # FreeBSD clang version 3.4.1 (tags/RELEASE...)
 get_version_line() {
-	LANG=C $CC -v 2>&1 | grep ' version '
+	LANG=C LC_ALL=C $CC -v 2>&1 | grep ' version '
 }
 
 get_family() {




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux