On May 9, 2022 11:52 AM, Junio C Hamano wrote: >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() { Just a small transfer of experience from a different project - if we transition or expand LOCALE functions into C at some point. Be aware that the locale_t series in C is not supported universally, despite being in POSIX going back a few years. We found, at least on the OpenSSL project, that using locale_t caused compile breakages on a variety of platforms, including some older but active Linux variants. Just raising awareness as I'm working this issue there. Sincerely, Randall