lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <02ce99b98cd21c67f30d5be1e5fd4fd130e0413d.camel@perches.com>
Date:   Fri, 29 Sep 2023 16:29:17 -0700
From:   Joe Perches <joe@...ches.com>
To:     David Laight <David.Laight@...LAB.COM>,
        Matthew Maurer <mmaurer@...gle.com>,
        Miguel Ojeda <ojeda@...nel.org>,
        Alex Gaynor <alex.gaynor@...il.com>,
        Wedson Almeida Filho <wedsonaf@...il.com>
Cc:     Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
        Björn Roy Baron <bjorn3_gh@...tonmail.com>,
        Benno Lossin <benno.lossin@...ton.me>,
        Andreas Hindborg <a.hindborg@...sung.com>,
        Alice Ryhl <aliceryhl@...gle.com>,
        "rust-for-linux@...r.kernel.org" <rust-for-linux@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] rust: Use awk instead of recent xargs

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 } }'

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ