[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK7LNATm5OS8wUh8boZJ9x65SUxajtDZV9bNdAvXcRgHC2NQdA@mail.gmail.com>
Date: Sat, 18 May 2019 00:56:44 +0900
From: Masahiro Yamada <yamada.masahiro@...ionext.com>
To: Alexander Kapshuk <alexander.kapshuk@...il.com>
Cc: Bernd Petrovitsch <bernd@...rovitsch.priv.at>,
Linux Kbuild mailing list <linux-kbuild@...r.kernel.org>,
Sam Ravnborg <sam@...nborg.org>, Arnd Bergmann <arnd@...db.de>,
Greg KH <gregkh@...uxfoundation.org>,
Jessica Yu <jeyu@...nel.org>,
Lucas De Marchi <lucas.de.marchi@...il.com>,
Stephen Rothwell <sfr@...b.auug.org.au>,
Michael Schmitz <schmitzmic@...il.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Rusty Russell <rusty@...tcorp.com.au>,
Kees Cook <keescook@...omium.org>,
Michal Marek <michal.lkml@...kovi.net>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] kbuild: check uniqueness of module names
On Fri, May 17, 2019 at 6:25 PM Alexander Kapshuk
<alexander.kapshuk@...il.com> wrote:
>
> On Fri, May 17, 2019 at 11:58 AM Bernd Petrovitsch
> <bernd@...rovitsch.priv.at> wrote:
> >
> > On 17/05/2019 10:16, Alexander Kapshuk wrote:
> > [...]
> > > The 'xargs' '-r' flag is a GNU extension.
> > > If POSIX compliance is important here, the use of 'cat', 'xargs' and
> > > 'basename' may be substituted with that of 'sed' to initialise
> > > same_name_modules:
> > > sed 's!.*/!!' modules.order modules.builtin | sort | uniq -d
> >
> > 's!' is TTBOMK also a GNU-extension:
> > sed 's/.*\///' modules.order modules.builtin | sort | uniq -d
>
> It isn't.
> Here's an excerpt from the POSIX manpage for 'sed',
> http://pubs.opengroup.org/onlinepubs/009695399/utilities/sed.html:
> [2addr]s/BRE/replacement/flags
> ... Any character other than backslash or <newline> can be used
> instead of a slash to delimit the BRE and the replacement....
>
> >
> > > 'Sed' may also be used on its own in the 'for' loop instead of as part
> > > of a pipeline along with 'grep' to generate the desired output:
> > > sed '/\/'$m'/!d;s:^kernel/: :' modules.order modules.builtin
> >
> > sed "/\/${m}/!d;s/^kernel\// /" modules.order modules.builtin
>
> The parameter expansion syntax is redundant here.
> See https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02:
> The parameter name or symbol can be enclosed in braces, which are
> optional except for positional parameters with more than one digit or
> when parameter is a name and is followed by a character that could be
> interpreted as part of the name.
>
> Here's an alternative version using double quotes.
> sed "/\/$m/!d;s:^kernel/: :" modules.order modules.builtin
Awesome!
This is much shorter.
I will use it in v3.
Thanks.
--
Best Regards
Masahiro Yamada
Powered by blists - more mailing lists