Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp1723512rwb; Sun, 15 Jan 2023 03:17:04 -0800 (PST) X-Google-Smtp-Source: AMrXdXuNGe2PtXkq/fU14dV66oNvYG2gnNjUPeCZTrUmTdBZbYS+Re+TdWxcUIPLsT+nhefoP0Ag X-Received: by 2002:a17:906:148a:b0:7cd:dbe8:e4f7 with SMTP id x10-20020a170906148a00b007cddbe8e4f7mr74659037ejc.77.1673781424127; Sun, 15 Jan 2023 03:17:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673781424; cv=none; d=google.com; s=arc-20160816; b=u0xw6dH61MMk3CGYJY1isKL5Pdf5ZgzS4fEawIoq9b/g2hecXZMuZYmd6KRSmORz8l ZF0hZsO73exc9dSM/MKVeQ1jG4VrLGzA1HsppplkVsggGJtH/y1zha+QsvbhH8a9AttH i1kaLIrw6N0AnaRXwH2dPcCwhtkmuYybdF4qY2P0Xlif+KksLr+QB7S0BiLKa0az5oev bLOI8LoJvEtStgoTrQfzx5k/yPxWcj91TLf9w9HwKOCy4GsGZo3jjBCleMLnoT/PJK0J 4Ll8yJxtwNaRjeMIkhROEP4pUj7fq5HDxcUtmHNeAXBk6tsHNx1ggWNZ3+Dd643C8Fhk 7+nQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=sDOmBnY7thIM2KZxCizyc6uqSHS+09za1tT8K7iWzys=; b=ByX+E1Ijk3GCOPwzbQMh8td0ZJnBQetiyE9Rhs1s94lTsR1YZmYlNE/69WU00rzjoy ovu+lmGflSV+BboiukOzDT7QaIZ5EZ2dbiBr3ZkBNyDjgIKHL/OsNR6+RbEFjNXUWSNT D2sU21+n0/2+qQ13f+spBdk/M6IpXT2zAaNLsEpCth4fupuRNtBHCuZq7GlWjNE1G8F9 IgduwBvsxQfgVXDv7phBqKh1t3TwYwB2bDMvHV9pi65Bp3a7oHNzjiLFQjv8m7cUqpMZ 6npXGIkPBUWu31M7kRjcQ8S7yFThaT3xEnxfYIw5ZDlZSylEbpsfqEQlp4BDeUrB+PbW y09w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jRu03WoQ; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gt37-20020a1709072da500b0084d34979413si2203818ejc.332.2023.01.15.03.16.48; Sun, 15 Jan 2023 03:17:04 -0800 (PST) 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=jRu03WoQ; 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 S230332AbjAOKtm (ORCPT + 52 others); Sun, 15 Jan 2023 05:49:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230003AbjAOKtk (ORCPT ); Sun, 15 Jan 2023 05:49:40 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CBE5CDEC; Sun, 15 Jan 2023 02:49:38 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1769DB80B06; Sun, 15 Jan 2023 10:49:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4D63C433EF; Sun, 15 Jan 2023 10:49:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673779775; bh=OgDN7XhvhGQQg/Z/xx44nHHo48uhQDWG853IVpEr0qg=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=jRu03WoQyLf3Q1MTtBJGdW33TWSMSPOrmQhLdT+xnDfJ7YIdIDNScdarn7+g6qq6q 2s7sM4PNPiTXtFeOvgspA5z0XK2i4S8hhvHqvvFmLNZr/0vsSNhba9P+6NlObUvwzU NzbFpwasTLYnHKK/8rPRVmatK3EaNtVIP8hSTV3dX57bNHclJvCFjmY6L5Q93sKmYl 586BiHqcSpna9tagaXItYJVJ5rnwfr9DqXy5ldCRKiSs2sYTlrHpke7uuv8H/A1w2Q MnbE6WrXP9GF8is2nuOPD0eH53xqebBa5kd2xQ2upym1nEpftCsZ1ipyOu7TYW24jP DptK4Q+7G2lhA== Received: by mail-oi1-f169.google.com with SMTP id d127so21057645oif.12; Sun, 15 Jan 2023 02:49:35 -0800 (PST) X-Gm-Message-State: AFqh2kpnWHo0wsF1jqkr0MW7tLgG2cB5A7twk0JcMdMVkJA5CxyoLUGw zivvQwzr8R28N5wETFZ+oqEO/HIAEpVAoUPmJfo= X-Received: by 2002:aca:3755:0:b0:35e:7c55:b015 with SMTP id e82-20020aca3755000000b0035e7c55b015mr5483293oia.287.1673779774935; Sun, 15 Jan 2023 02:49:34 -0800 (PST) MIME-Version: 1.0 References: <20230109204520.539080-1-ojeda@kernel.org> <20230109204520.539080-6-ojeda@kernel.org> In-Reply-To: From: Masahiro Yamada Date: Sun, 15 Jan 2023 19:48:58 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 6/6] kbuild: rust_is_available: normalize version matching To: Miguel Ojeda Cc: Miguel Ojeda , linux-kbuild@vger.kernel.org, Nathan Chancellor , Nick Desaulniers , Nicolas Schier , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev, Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= Content-Type: text/plain; charset="UTF-8" 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 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: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jan 15, 2023 at 11:48 AM Masahiro Yamada wrote: > > On Sat, Jan 14, 2023 at 8:15 AM Miguel Ojeda > wrote: > > > > On Thu, Jan 12, 2023 at 7:23 AM Masahiro Yamada wrote: > > > > > > Maybe, your purpose is to use sed consistently, but > > > perhaps you can avoid forking sed if you know the > > > format of the first line. > > > > The most unknown format would be the one of the libclang check, where > > there may be other lines before the one we are interested in. However, > > the pattern expansion would still match newlines, right? > > > > > BTW, what is missing here is, you do not check if > > > ${RUSTC} is really rustc. > > > > > > I can fool this script to print > > > "arithmetic expression: expecting primary: "100000 * + 100 * + " > > > > We can test if nothing was printed by `sed` for that (or do it with > > shell builtins). > > > > Having said that, I would say fooling the script on purpose is an more > > of an oddity compared to the case `MAKEFLAGS` attempts to cover > > (please see my reply on the other patch). So if we cover this, then I > > would say we should really cover the other one. > > > > get_canonical_version() in scripts/as-version.sh has > a little more trick to avoid > "arithmetic expression: expecting primary: "100000 * + 100 * + " > but it is up to you. My code accepts anything that is separated by dots (and non-numerical strings are silently turned into zero). Your code takes exactly the "([0-9]+\.[0-9]+\.[0-9]+)" pattern, so it works very safely. I think using sed is fine. -- Best Regards Masahiro Yamada