Message ID | 20230528131802.6390-2-ethan.twardy@gmail.com |
---|---|
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 k13csp967476vqr; Sun, 28 May 2023 06:58:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4llk3XuQNuPWtdmFRf3cUSsPZbVvJgA5miDW7C+2xaBTHtKgeCT1pLv9E89A1aC2Tcj/7r X-Received: by 2002:a17:90a:c257:b0:256:3188:7ee6 with SMTP id d23-20020a17090ac25700b0025631887ee6mr7878018pjx.45.1685282298225; Sun, 28 May 2023 06:58:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685282298; cv=none; d=google.com; s=arc-20160816; b=ZzGmB9hxnTkbUSSrNdFTGA+aW45LAW0GnvYuKRDR2LvtM3ha9ZZEklgMFkqTLM4pWA uNao6Gsxh/nX0iOmGfx+utqWEniTJf7Si/wvo0xM89yeoICTzuEbs3o/MrrCnlvrtQCr Lbk0g8saNL6HYjEqUgTrsMBD7mgP74FifdoEr3LbDny+xoFm0q6oy83+IWbKLasNqbCO qHAC1He0Td0BER1aObJGrt3LeHkiWMlQPmT2Um7h9nd2XOfFcLNRGNgF1igZoafntryc syFq2gmN+DItGKJvL7xUREtgaPGUYVvQ3l07d4PRmQ3RlQ1HJ1QFcymYB78HBe4g9Ls2 f3/Q== 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=4ggyLkGv6g0jo85hrXvJLdeY1eXxDxkX/cg7GhTS4sI=; b=zDvni+qj2meclENJeS/flhLHvnXdSNrG9BBYKZMcmm+71ROpYkeC7ccsIfVYFkQg2J 1yg6hGzdTLflOYHV3QpTT4hhavpKWxtUIgkzARF3K8mEPLVHc2bmkyVEIID7iplT2wxD HhJ++ZHIR7M36x7trCayXrb/IYJreUZD2/8FPkiMTo/VgdbpJEirrr/RrdVT0nATGr+e vRbQIjbM9/mNSck7m17PxWouJ6WpPtspquRhqGPO7/Nw+EnpR0N1O6gNDdlD+7igvzcB VaoZ6FMQfH0DOSMGIEuCNrrXukpQN+SF8sLe6FMODWgEJ71aq0B+wgAX1uDzYQ2BqdWg PnTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=aIBF6b59; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hg15-20020a17090b300f00b002567ea157e6si285361pjb.136.2023.05.28.06.58.04; Sun, 28 May 2023 06:58:18 -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=@gmail.com header.s=20221208 header.b=aIBF6b59; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229606AbjE1NVI (ORCPT <rfc822;syz17693488234@gmail.com> + 99 others); Sun, 28 May 2023 09:21:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229592AbjE1NVE (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 28 May 2023 09:21:04 -0400 Received: from mail-qt1-x830.google.com (mail-qt1-x830.google.com [IPv6:2607:f8b0:4864:20::830]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BE77BE; Sun, 28 May 2023 06:21:03 -0700 (PDT) Received: by mail-qt1-x830.google.com with SMTP id d75a77b69052e-3f6c229b42bso11935981cf.0; Sun, 28 May 2023 06:21:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685280062; x=1687872062; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4ggyLkGv6g0jo85hrXvJLdeY1eXxDxkX/cg7GhTS4sI=; b=aIBF6b59zCRUAFbsviZO2vgNM+XM7mLFoWPVhWAuTOkeq320Ub6GSuS925yI0+uIQg YZAPupRUPu36GoC6sG6P1NaOHkcR/qWgBwJJJoEzEcajnfkmSYZrrznxahNUUQ3O7jlj A9REwphBY3TX2DE4xZ86Bmva0sn/eP2AffDJ24UtrivbhPdS6z+ScZqC5e8ueCubNNU2 x8zlgeMt4vdx2L5iirnlglRnYLof0b1zriQ6GwZg+6w/bIi1+XneBfV0kAhWgMOLIIH/ tn1pXiDs4p4HvW3TnYpCUuxMl8WZCWl4zIFK9QJl1XpufZsps3hNIwwQD9ySqGv4bRzi reVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685280062; x=1687872062; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4ggyLkGv6g0jo85hrXvJLdeY1eXxDxkX/cg7GhTS4sI=; b=WE36U8DVxVPJQV+Vp3TBQR+GzqqbjXyDUk+qBB0n1CRJDatD9aUhYBQEmsJDynRTDM w582zKAqQhasig9xuNe/eGADydYqcjcQPsIeKo4VvV6bsUUkzolcxvDuRJ+/bG7zwu8M imJTF0Gn9yb8/vkV+VNLc/msEYH+t9fZvxeUK/8tdr26MuegcNeOMmR61eiw63w9E8cE /RD5hj5h5iOhJp2vJcf5ODdc/FseewLz9MCqTKD/G6AQDFzufvlsuFNoRkk9qcKkwotd w9LyKzVvf9gxbv+jkEf1HOo2aXNVlWAuZpjl0JIx3S7pTiwNWSgJcBKQkHY63SqQD32H 7FwQ== X-Gm-Message-State: AC+VfDzHPwQhsrgmkuduXsQmrMaEbyL8arYf4xdknjlckocMV4FYDlqg 3c02KoQMvbdlgP177uKgDFM= X-Received: by 2002:ad4:5f08:0:b0:626:1ca6:5efe with SMTP id fo8-20020ad45f08000000b006261ca65efemr1344446qvb.9.1685280062336; Sun, 28 May 2023 06:21:02 -0700 (PDT) Received: from localhost.localdomain (2603-6000-8100-7fd4-0000-0000-0000-0619.res6.spectrum.com. [2603:6000:8100:7fd4::619]) by smtp.gmail.com with ESMTPSA id x5-20020ad44585000000b005dd8b9345b9sm87190qvu.81.2023.05.28.06.21.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 May 2023 06:21:02 -0700 (PDT) From: "Ethan D. Twardy" <ethan.twardy@gmail.com> To: Miguel Ojeda <ojeda@kernel.org>, Alex Gaynor <alex.gaynor@gmail.com>, Wedson Almeida Filho <wedsonaf@gmail.com>, 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>, Nathan Chancellor <nathan@kernel.org>, Nick Desaulniers <ndesaulniers@google.com>, Tom Rix <trix@redhat.com>, Tiago Lam <tiagolam@gmail.com>, Kees Cook <keescook@chromium.org>, Finn Behrens <me@kloenk.de>, rust-for-linux@vger.kernel.org (open list:RUST), linux-kernel@vger.kernel.org (open list), llvm@lists.linux.dev (open list:CLANG/LLVM BUILD SUPPORT) Cc: "Ethan D. Twardy" <ethan.twardy@gmail.com> Subject: [PATCH v2 1/1] scripts/rust_is_available: Fix clang version check Date: Sun, 28 May 2023 08:18:02 -0500 Message-Id: <20230528131802.6390-2-ethan.twardy@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230528131802.6390-1-ethan.twardy@gmail.com> References: <20230528131802.6390-1-ethan.twardy@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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?1767146571023742810?= X-GMAIL-MSGID: =?utf-8?q?1767146571023742810?= |
Series |
Fix libclang version check for rustavailable
|
|
Commit Message
Ethan D. Twardy
May 28, 2023, 1:18 p.m. UTC
During out-of-tree builds where the path to the kernel source tree
contains a version string, scripts/rust_is_available.sh incorrectly
identified the version string of libclang to be the version string in
the kernel sources path, resulting in CONFIG_RUST_IS_AVAILABLE
erroneously set to 'n'.
This issue was previously affecting builds on distributions, such as
Gentoo Linux, where the kernel source tree is under version control,
and placed under a path containing the current kernel version string
in /usr/src.
The fix is to take special care to match only the version string
following the string 'clang version' in the output.
To reproduce:
$ cd ~/build && make -C ~/linux-6.2.0 O=$PWD LLVM=1 rustavailable
[...]
*** libclang (used by the Rust bindings generator 'bindgen') is too old.
*** Your version: 6.2.0
*** Minimum version: 11.0.0
[...]
Fixes: 78521f3399ab ("scripts: add `rust_is_available.sh`")
Signed-off-by: Ethan D. Twardy <ethan.twardy@gmail.com>
Comments
On 5/28/23 10:18, Ethan D. Twardy wrote: > [...] > --- a/scripts/rust_is_available.sh > +++ b/scripts/rust_is_available.sh > @@ -102,8 +102,8 @@ fi > # Check that the `libclang` used by the Rust bindings generator is suitable. > bindgen_libclang_version=$( \ > LC_ALL=C "$BINDGEN" $(dirname $0)/rust_is_available_bindgen_libclang.h 2>&1 >/dev/null \ > - | grep -F 'clang version ' \ > - | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' \ > + | grep -oE 'clang version [0-9]+\.[0-9]+\.[0-9]+' \ > + | cut -d' ' -f3 \ > | head -n 1 \ > ) > bindgen_libclang_min_version=$($min_tool_version llvm) Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com> Tested-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
Greetings, Martin! Thanks very much for your testing and review. Do I need to take any further action to make this patch ready for review? I sent out a v3 version of the patch, where the only change was adding Reviewed-By and Tested-By tags to my git commit--since this is my first time contributing to this community, I wasn't sure whether I needed to do that. Thanks! Sincerely, Ethan Twardy
On 6/14/23 09:08, Ethan D. Twardy wrote: > Greetings, Martin! > > Thanks very much for your testing and review. Do I need to take any > further action to make this patch ready for review? I sent out a v3 > version of the patch, where the only change was adding Reviewed-By and > Tested-By tags to my git commit--since this is my first time > contributing to this community, I wasn't sure whether I needed to do > that. Thanks! > > Sincerely, > > Ethan Twardy Unless other reviewers requested changes, you have to rebase your work or you want to make a modification, it is not necessary to send a new version of the patch series, generally, maintainers will, and have to, add any Reviewed-bys or Tested-bys prior to merging.
On Sun, May 28, 2023 at 3:21 PM Ethan D. Twardy <ethan.twardy@gmail.com> wrote: > > During out-of-tree builds where the path to the kernel source tree > contains a version string, scripts/rust_is_available.sh incorrectly > identified the version string of libclang to be the version string in > the kernel sources path, resulting in CONFIG_RUST_IS_AVAILABLE > erroneously set to 'n'. > > This issue was previously affecting builds on distributions, such as > Gentoo Linux, where the kernel source tree is under version control, > and placed under a path containing the current kernel version string > in /usr/src. > > The fix is to take special care to match only the version string > following the string 'clang version' in the output. > > To reproduce: > > $ cd ~/build && make -C ~/linux-6.2.0 O=$PWD LLVM=1 rustavailable > [...] > *** libclang (used by the Rust bindings generator 'bindgen') is too old. > *** Your version: 6.2.0 > *** Minimum version: 11.0.0 > [...] > > Fixes: 78521f3399ab ("scripts: add `rust_is_available.sh`") > Signed-off-by: Ethan D. Twardy <ethan.twardy@gmail.com> Thanks a lot for this patch! This was previously reported and should be fixed in this patch series (I added you as a reporter in v2): https://lore.kernel.org/rust-for-linux/20230616001631.463536-1-ojeda@kernel.org/ If you could please test the series, to make sure it solves your issue, it would be great! Cheers, Miguel
On Wed, Jun 14, 2023 at 2:08 PM Ethan D. Twardy <ethan.twardy@gmail.com> wrote: > > Thanks very much for your testing and review. Do I need to take any > further action to make this patch ready for review? I sent out a v3 > version of the patch, where the only change was adding Reviewed-By and > Tested-By tags to my git commit--since this is my first time > contributing to this community, I wasn't sure whether I needed to do > that. Thanks! You did everything well! The patch looked fine to me, and the commit message is detailed. The tags are all fine too. Thanks a lot for the effort! I had v2 of the script improvement patch series in my backlog, which normalizes to `sed` (rather than use `grep`/`cut` etc.), adds a test suite, and a few other things; but otherwise we could have easily taken this one, because it is well done. So, you did everything right, and you are more than welcome to send more patches like that :) Cheers, Miguel
diff --git a/scripts/rust_is_available.sh b/scripts/rust_is_available.sh index aebbf1913970..e8a1439be9f8 100755 --- a/scripts/rust_is_available.sh +++ b/scripts/rust_is_available.sh @@ -102,8 +102,8 @@ fi # Check that the `libclang` used by the Rust bindings generator is suitable. bindgen_libclang_version=$( \ LC_ALL=C "$BINDGEN" $(dirname $0)/rust_is_available_bindgen_libclang.h 2>&1 >/dev/null \ - | grep -F 'clang version ' \ - | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' \ + | grep -oE 'clang version [0-9]+\.[0-9]+\.[0-9]+' \ + | cut -d' ' -f3 \ | head -n 1 \ ) bindgen_libclang_min_version=$($min_tool_version llvm)