git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Michael J Gruber <git@grubix.eu>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] detect-compiler: make detection independent of locale
Date: Mon, 09 May 2022 08:52:16 -0700	[thread overview]
Message-ID: <xmqq7d6ug0un.fsf@gitster.g> (raw)
In-Reply-To: <f306f43f375bc9b9c98e85260587442e5d9ef0ba.1652094958.git.git@grubix.eu> (Michael J. Gruber's message of "Mon, 9 May 2022 13:22:02 +0200")

Michael J Gruber <git@grubix.eu> 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() {

  reply	other threads:[~2022-05-09 15:52 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-06 18:04 [PATCH 0/2] quell a few gcc warnings Michael J Gruber
2022-05-06 18:04 ` [PATCH 1/2] dir.c: avoid gcc warning Michael J Gruber
2022-05-06 20:21   ` Junio C Hamano
2022-05-09 15:58     ` Taylor Blau
2022-05-07  6:14   ` Carlo Marcelo Arenas Belón
2022-05-06 18:04 ` [PATCH 2/2] http.c: " Michael J Gruber
2022-05-06 20:22   ` Junio C Hamano
2022-05-06 21:17     ` [PATCH] http.c: clear the 'finished' member once we are done with it Junio C Hamano
2022-05-07  5:40       ` Carlo Marcelo Arenas Belón
2022-05-07 18:42         ` Junio C Hamano
2022-05-07 19:11           ` Carlo Arenas
2022-05-23 21:58       ` Johannes Schindelin
2022-05-23 22:58         ` Junio C Hamano
2022-05-23 23:36           ` Junio C Hamano
2022-05-23 23:41           ` Johannes Schindelin
2022-05-24  0:02             ` Junio C Hamano
2022-05-24  6:31               ` Daniel Stenberg
2022-05-24 10:57                 ` Johannes Schindelin
2022-05-24 17:45                 ` Junio C Hamano
2022-05-26 14:15                   ` Daniel Stenberg
2022-05-24 11:03               ` Johannes Schindelin
2022-05-24 17:15                 ` Junio C Hamano
2022-05-24 20:16                   ` Carlo Marcelo Arenas Belón
2022-05-24 20:45                     ` Ævar Arnfjörð Bjarmason
2022-05-24 22:34                       ` Junio C Hamano
2022-05-25  9:08                         ` Michael J Gruber
2022-05-25 13:27                         ` Ævar Arnfjörð Bjarmason
2022-05-24 22:16                     ` Junio C Hamano
2022-05-24 23:19                     ` Junio C Hamano
2022-05-25  2:02                       ` Carlo Arenas
2022-05-24 20:38                   ` Ævar Arnfjörð Bjarmason
2022-05-24 22:28                     ` Junio C Hamano
2022-05-25 10:07                       ` Johannes Schindelin
2022-05-25 16:40                         ` Junio C Hamano
2022-05-06 20:41   ` [PATCH 2/2] http.c: avoid gcc warning Carlo Marcelo Arenas Belón
2022-05-09 11:22 ` [PATCH] detect-compiler: make detection independent of locale Michael J Gruber
2022-05-09 15:52   ` Junio C Hamano [this message]
2022-05-09 15:59     ` rsbecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq7d6ug0un.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@grubix.eu \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).