[v2,02/11] kbuild: rust_is_available: fix version check when CC has multiple arguments
Message ID | 20230616001631.463536-3-ojeda@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp997277vqr; Thu, 15 Jun 2023 17:19:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ531T40VRxcHqd3LKnrgg0XoYGzToWt1uwIMvY87FNHKqg1xIYAMnDiOaUCG1HVrRjQ0y8d X-Received: by 2002:a05:6808:d51:b0:399:8529:6726 with SMTP id w17-20020a0568080d5100b0039985296726mr814206oik.51.1686874794430; Thu, 15 Jun 2023 17:19:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686874794; cv=none; d=google.com; s=arc-20160816; b=cqmxZh+uifNYYvM+GzOEL+TL71IjHI3LovDSYKJd2XC7krXoke5AcB3Cbwomg8SiHt vQiR3ISUbrjT+u4F5J+u9Bv0jJPNYzJa+fvtnLNKc8SiJActVRv2yAbEWhC2kTGM7vnT ijowQmMyTQ0lqnyKcD+r2Guy4WNmXuov3yj0Ugx8PvN+9niuCKBmMg35KoMolGzxTJMK ugZ4zprdzI23W1fxWCBi++BpF9K8DaMzKaWnKVJVgLB9e0vCGYoYvRuhcw+oFaGWBvWf CjndtXabIOqFlHqpqVXkb5OJxboV+HqjBIW6kqnRB7FS5fLQ3UlK/yNTCNfcRcb9rfMH YO2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=vpfxxwHJe3W9VZYIkDAYgzuz9DA/FTw6maxjX+yv1i0=; b=yPnk3CYcy8TyqCwQY09EOIzWiJKnAMvkScy/BLJoHtGyF0XHDjGiiXvaFxHyUxSdFs dnqD66O+gI/TCDB6ogAuKuf+RbrGPgUgnbig9EcBsWC8/WEhKLs1dkTNVHZ3xKwjLJyL xjOXF2hwNuekso9kO5zA0WvVO5vmsqmStALw+1+15fW9sNM+P36hwSIc8jdz/jfa4aMG Y0pbcxZZeZUoTi2i4sLAhUF9LhT0ehEFnIwO2sXzC6J3eooEuugZaJS7iH71YvbLnXDd gtaoq643EwltPsxBd/jQAX6rjCGPI6i1h/I7Sk180DxOmqMSKasR4OeVzSoirZkUXFmt I6bA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lR3gCslZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k189-20020a633dc6000000b0053eedcd4d81si13916306pga.101.2023.06.15.17.19.39; Thu, 15 Jun 2023 17:19:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lR3gCslZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240563AbjFPARH (ORCPT <rfc822;maxin.john@gmail.com> + 99 others); Thu, 15 Jun 2023 20:17:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240508AbjFPARE (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 15 Jun 2023 20:17:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 610F22944; Thu, 15 Jun 2023 17:17:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E8F6061CDB; Fri, 16 Jun 2023 00:17:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E47CCC433C8; Fri, 16 Jun 2023 00:16:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686874622; bh=CG+nA737Ne3Ravt2rZwGSjf5nReCzoy15WvmtU+wHWo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lR3gCslZ4vHZLbRAmDnKtb5u2/yufUzYTAGEMOQQW/VbICIINE5k6cxPy6LY/3egY 9r+Ferze24Bqk9vhbg3jE95QIJ+CZ+hQI/zMUSaQzcPHbfLgUMZCkOqjwbkgX8DxcK s4WTNY3jEJiBpZGXkIpLy+xOcMzDqNR026Sr6M0VzRBKga6OCq67RAUbsh+rfXXAC3 oms90zuaeA92CdqYFWQeVp77+B6WxjolQHGLJg8QsYO+OWtCqwYiIReG/3EKYAn/uz g5P27JmMgNQMOgnSqaXia+I5jM1Mi2dE38CkrrACVxjaC52vQeZZnxkroIzzvxomBD WRif/mxmxdNZw== From: Miguel Ojeda <ojeda@kernel.org> To: Masahiro Yamada <masahiroy@kernel.org>, Miguel Ojeda <ojeda@kernel.org>, Wedson Almeida Filho <wedsonaf@gmail.com>, Alex Gaynor <alex.gaynor@gmail.com> Cc: Nathan Chancellor <nathan@kernel.org>, Nick Desaulniers <ndesaulniers@google.com>, Nicolas Schier <nicolas@fjasle.eu>, Boqun Feng <boqun.feng@gmail.com>, Gary Guo <gary@garyguo.net>, =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= <bjorn3_gh@protonmail.com>, Benno Lossin <benno.lossin@proton.me>, Alice Ryhl <aliceryhl@google.com>, Andreas Hindborg <nmi@metaspace.dk>, linux-kbuild@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev, Russell Currey <ruscur@russell.cc> Subject: [PATCH v2 02/11] kbuild: rust_is_available: fix version check when CC has multiple arguments Date: Fri, 16 Jun 2023 02:16:22 +0200 Message-ID: <20230616001631.463536-3-ojeda@kernel.org> In-Reply-To: <20230616001631.463536-1-ojeda@kernel.org> References: <20230616001631.463536-1-ojeda@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768816424415555880?= X-GMAIL-MSGID: =?utf-8?q?1768816424415555880?= |
Series |
`scripts/rust_is_available.sh` improvements
|
|
Commit Message
Miguel Ojeda
June 16, 2023, 12:16 a.m. UTC
From: Russell Currey <ruscur@russell.cc> rust_is_available.sh uses cc-version.sh to identify which C compiler is in use, as scripts/Kconfig.include does. cc-version.sh isn't designed to be able to handle multiple arguments in one variable, i.e. "ccache clang". Its invocation in rust_is_available.sh quotes "$CC", which makes $1 == "ccache clang" instead of the intended $1 == ccache & $2 == clang. cc-version.sh could also be changed to handle having "ccache clang" as one argument, but it only has the one consumer upstream, making it simpler to fix the caller here. Signed-off-by: Russell Currey <ruscur@russell.cc> Fixes: 78521f3399ab ("scripts: add `rust_is_available.sh`") Link: https://github.com/Rust-for-Linux/linux/pull/873 [ Reworded title prefix and reflow line to 75 columns. ] Signed-off-by: Miguel Ojeda <ojeda@kernel.org> --- scripts/rust_is_available.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Comments
On 6/15/23 21:16, Miguel Ojeda wrote: > From: Russell Currey <ruscur@russell.cc> > > rust_is_available.sh uses cc-version.sh to identify which C compiler is > in use, as scripts/Kconfig.include does. cc-version.sh isn't designed to > be able to handle multiple arguments in one variable, i.e. "ccache clang". > Its invocation in rust_is_available.sh quotes "$CC", which makes > $1 == "ccache clang" instead of the intended $1 == ccache & $2 == clang. > > cc-version.sh could also be changed to handle having "ccache clang" as one > argument, but it only has the one consumer upstream, making it simpler to > fix the caller here. > > Signed-off-by: Russell Currey <ruscur@russell.cc> > Fixes: 78521f3399ab ("scripts: add `rust_is_available.sh`") > Link: https://github.com/Rust-for-Linux/linux/pull/873 > [ Reworded title prefix and reflow line to 75 columns. ] > Signed-off-by: Miguel Ojeda <ojeda@kernel.org> > --- > [...] Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
On Fri, Jun 16, 2023 at 02:16:22AM +0200, Miguel Ojeda wrote: > From: Russell Currey <ruscur@russell.cc> > > rust_is_available.sh uses cc-version.sh to identify which C compiler is > in use, as scripts/Kconfig.include does. cc-version.sh isn't designed to > be able to handle multiple arguments in one variable, i.e. "ccache clang". > Its invocation in rust_is_available.sh quotes "$CC", which makes > $1 == "ccache clang" instead of the intended $1 == ccache & $2 == clang. > > cc-version.sh could also be changed to handle having "ccache clang" as one > argument, but it only has the one consumer upstream, making it simpler to > fix the caller here. > > Signed-off-by: Russell Currey <ruscur@russell.cc> > Fixes: 78521f3399ab ("scripts: add `rust_is_available.sh`") > Link: https://github.com/Rust-for-Linux/linux/pull/873 > [ Reworded title prefix and reflow line to 75 columns. ] > Signed-off-by: Miguel Ojeda <ojeda@kernel.org> Reviewed-by: Nathan Chancellor <nathan@kernel.org> > --- > scripts/rust_is_available.sh | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/scripts/rust_is_available.sh b/scripts/rust_is_available.sh > index f43a010eaf30..0c9be438e4cd 100755 > --- a/scripts/rust_is_available.sh > +++ b/scripts/rust_is_available.sh > @@ -113,10 +113,10 @@ fi > # > # In the future, we might be able to perform a full version check, see > # https://github.com/rust-lang/rust-bindgen/issues/2138. > -cc_name=$($(dirname $0)/cc-version.sh "$CC" | cut -f1 -d' ') > +cc_name=$($(dirname $0)/cc-version.sh $CC | cut -f1 -d' ') > if [ "$cc_name" = Clang ]; then > clang_version=$( \ > - LC_ALL=C "$CC" --version 2>/dev/null \ > + LC_ALL=C $CC --version 2>/dev/null \ > | sed -nE '1s:.*version ([0-9]+\.[0-9]+\.[0-9]+).*:\1:p' > ) > if [ "$clang_version" != "$bindgen_libclang_version" ]; then > -- > 2.41.0 >
diff --git a/scripts/rust_is_available.sh b/scripts/rust_is_available.sh index f43a010eaf30..0c9be438e4cd 100755 --- a/scripts/rust_is_available.sh +++ b/scripts/rust_is_available.sh @@ -113,10 +113,10 @@ fi # # In the future, we might be able to perform a full version check, see # https://github.com/rust-lang/rust-bindgen/issues/2138. -cc_name=$($(dirname $0)/cc-version.sh "$CC" | cut -f1 -d' ') +cc_name=$($(dirname $0)/cc-version.sh $CC | cut -f1 -d' ') if [ "$cc_name" = Clang ]; then clang_version=$( \ - LC_ALL=C "$CC" --version 2>/dev/null \ + LC_ALL=C $CC --version 2>/dev/null \ | sed -nE '1s:.*version ([0-9]+\.[0-9]+\.[0-9]+).*:\1:p' ) if [ "$clang_version" != "$bindgen_libclang_version" ]; then