From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS3215 2.6.0.0/16 X-Spam-Status: No, score=-3.0 required=3.0 tests=AWL,BAYES_00,BODY_8BITS, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by dcvr.yhbt.net (Postfix) with ESMTP id A47CD1F4D8 for ; Mon, 9 May 2022 16:00:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238780AbiEIQD4 convert rfc822-to-8bit (ORCPT ); Mon, 9 May 2022 12:03:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238713AbiEIQDz (ORCPT ); Mon, 9 May 2022 12:03:55 -0400 Received: from elephants.elehost.com (elephants.elehost.com [216.66.27.132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 196812A7C0B for ; Mon, 9 May 2022 09:00:00 -0700 (PDT) Received: from Mazikeen (cpe00fc8d49d843-cm00fc8d49d840.cpe.net.cable.rogers.com [174.119.96.21] (may be forged)) (authenticated bits=0) by elephants.elehost.com (8.16.1/8.16.1) with ESMTPSA id 249Fxs5p031579 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 9 May 2022 11:59:54 -0400 (EDT) (envelope-from rsbecker@nexbridge.com) Reply-To: From: To: "'Junio C Hamano'" , "'Michael J Gruber'" Cc: References: In-Reply-To: Subject: RE: [PATCH] detect-compiler: make detection independent of locale Date: Mon, 9 May 2022 11:59:49 -0400 Organization: Nexbridge Inc. Message-ID: <034701d863bd$d3688200$7a398600$@nexbridge.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8BIT X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQKBROfmxINt9G3t8H7f4u2eJilVLQILeCTbAue0ZeurnVdx8A== Content-Language: en-ca Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On May 9, 2022 11:52 AM, Junio C Hamano wrote: >Michael J Gruber 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