Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp53181rdb; Fri, 29 Sep 2023 16:29:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHif12ItNV/aFLGaJU+sDTJVs56R4NhKCqHE9sxHJ6r5xNLpxRe58suAolDhn5+/e8zr0ln X-Received: by 2002:a05:6a00:1381:b0:690:4362:7012 with SMTP id t1-20020a056a00138100b0069043627012mr5840479pfg.28.1696030177306; Fri, 29 Sep 2023 16:29:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696030177; cv=none; d=google.com; s=arc-20160816; b=Jz9x5vXdpegqYY1lWAU6DDxef2GYAJIUuQqwMN05V0maKx9PrsWuILeyzcENQnwEm6 +rDvnlswjw2TyCrLPFfocq9FXbN6yfZnDKGWiURJ9r67EGHHK4Qw+yq3SqV8g9gB3efa fWcG4bO3bNjecpwT2Nd72nhpqqzoirfVNK3Kb1TMlJEJSNk1AwIjdFGQI180F3y0TH+D aK7n9/wDc0kXKRG6lJRHoKympcLDySRe6pyDsbCXErmlh5L/A5vOvUABhQNpRcrk/1r/ AmbBIGVYbvsy0gK5dPJrAPKj10jGToaF3/9kNZxO70MAh+P04hw1q0gmjJCIXK5vLExe R77A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id; bh=T48o50yyXDKrz2OMhYnElLyvTeYOHa92prMc7W3pVIU=; fh=t+3eoj8bxB7267kYO1FLG2MG9Ijm9Oopfh524qfzUeQ=; b=cMK3/JzVmNpjLB02XkNi5diE/ajeh1xXsO8+SQgnHoXg74QQrgxie685MgIUc50YzO ktBVWlxigPZnRzxYsOYYXvRXgzKmkuHsf6NaQZuH0645wPS0P6T2WUgbIONp52Y362/6 QjoijmTfhfQqYazLaN+t/1usbBF3kJAl8RhvJHXytdPFG+2hANfZDLcVXTjL8e4BGlQn vUeAVNbeWytQ+4SQgkaCOl8hqT8m6wNypWHD4OqWvEEzq1tE9d7yGXd22Y8NpChA/WZM LX9yz6vzqLzIsrWqQlg14BSGG3CBM0pXYv/f+AjhOhcu4ltzf4DKDVH4mcP8fjq81utd Tb/Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id z16-20020a656650000000b00577616e3ad9si18238166pgv.871.2023.09.29.16.29.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 16:29:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id F21EA828FC22; Fri, 29 Sep 2023 16:29:34 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230063AbjI2X3a convert rfc822-to-8bit (ORCPT + 99 others); Fri, 29 Sep 2023 19:29:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229508AbjI2X32 (ORCPT ); Fri, 29 Sep 2023 19:29:28 -0400 Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59F00EB; Fri, 29 Sep 2023 16:29:26 -0700 (PDT) Received: from omf07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 1FD741A05D2; Fri, 29 Sep 2023 23:29:22 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf07.hostedemail.com (Postfix) with ESMTPA id B10482002E; Fri, 29 Sep 2023 23:29:18 +0000 (UTC) Message-ID: <02ce99b98cd21c67f30d5be1e5fd4fd130e0413d.camel@perches.com> Subject: Re: [PATCH] rust: Use awk instead of recent xargs From: Joe Perches To: David Laight , Matthew Maurer , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho Cc: Boqun Feng , Gary Guo , =?ISO-8859-1?Q?Bj=F6rn?= Roy Baron , Benno Lossin , Andreas Hindborg , Alice Ryhl , "rust-for-linux@vger.kernel.org" , "linux-kernel@vger.kernel.org" Date: Fri, 29 Sep 2023 16:29:17 -0700 In-Reply-To: References: <20230928202116.2298150-1-mmaurer@google.com> <106c8bdb960da1568d0b3879efa76cd2acec032e.camel@perches.com> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8BIT User-Agent: Evolution 3.48.4 (3.48.4-1.fc38) MIME-Version: 1.0 X-Rspamd-Queue-Id: B10482002E X-Stat-Signature: 5x7bqnseu4i4qrk95mmsjmjjnwursijh X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Rspamd-Server: rspamout01 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX19KqW6+BJFwy7aVcBLC/jBgbHDcPJORu8k= X-HE-Tag: 1696030158-560548 X-HE-Meta: U2FsdGVkX19EIcvhOKccUk/K+iP+kHV0hP9ENaBwmQ8psiN52dkc7wSX+48GZZ2KcARzX4yokh3pcBT40s/ioX5czzUzm1lNUuw/CWchRfz7wkXDGyqGPdELmsykIs8/3lmw+fhhsLilM4AWnF/P8h4yAnqHpkO95g5z4EyMQnBZOa1PlwkW+6J53DBwMYG+RWPolxSDRW5x5SHmbIAdPSIyWB1QESgEjXIp3rPvBS4mJhB/R+Su8CPW3rT7YKtJfFEkMxqZ1kSLIaPe9ahqKhevDZaP96WR7Gh3avJko2GiAn5FASJFHNRhUiV2wQCZ X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Fri, 29 Sep 2023 16:29:35 -0700 (PDT) On Fri, 2023-09-29 at 21:36 +0000, David Laight wrote: > From: Joe Perches > > Sent: 28 September 2023 21:33 > > > > On Thu, 2023-09-28 at 20:21 +0000, Matthew Maurer wrote: > > > `awk` is already required by the kernel build, and the `xargs` feature > > > used in current Rust detection is not present in all `xargs` (notably, > > > toybox based xargs, used in the Android kernel build). > > [] > > > diff --git a/rust/Makefile b/rust/Makefile > > [] > > > @@ -365,8 +365,7 @@ quiet_cmd_exports = EXPORTS $@ > > > cmd_exports = \ > > > $(NM) -p --defined-only $< \ > > > | grep -E ' (T|R|D) ' | cut -d ' ' -f 3 \ > > > - | xargs -Isymbol \ > > > - echo 'EXPORT_SYMBOL_RUST_GPL(symbol);' > $@ > > > + | awk 'NF {printf "EXPORT_SYMBOL_RUST_GPL(%s);\n",$$0}' > $@ > > > > Perhaps remove the cut as well and use $$3 instead of $$0 ? > > Maybe integrate the grep as well. > > Or keep the grep and use a shell loop? > grep -E ' (T|R|D) ' | while read val flag symbol; do \ > echo "EXPORT_SYMBOL_RUST_GPL($symbol);"; done > > (The grep is typically much faster than a shell conditional.) > Bikeshed: no grep just a single awk with whatever the appropriate syntax is like awk '{ if ($$2 ~ /^[TRD]$/) { printf "EXPORT_SYMBOL_RUST(%s);\n", $$3 } }'