[arch-projects] [mkinitcpio][PATCH 09/26] functions: specify the delimiter to xargs

Dave Reisner d at falconindy.com
Mon Sep 26 23:48:18 EDT 2011


On Mon, Sep 26, 2011 at 10:46:57PM -0500, Dan McGee wrote:
> On Mon, Sep 26, 2011 at 8:22 PM, Dave Reisner <d at falconindy.com> wrote:
> > Without specifying this, xargs will split arguments on whitespace as
> > well as newlines, and will interpret quoting and backslashes. When the
> > delimiter is specified, every character is taken literally and only the
> > given delimiter in honored.
> >
> > This sidesteps issues with broken modalias files as evidenced by a
> > MacBookAir3,1 or the bbs thread below:
> >
> > https://bbs.archlinux.org/viewtopic.php?pid=971853
> >
> > Also fixes FS#25450.
> >
> > Signed-off-by: Dave Reisner <dreisner at archlinux.org>
> > ---
> >  functions |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/functions b/functions
> > index 8ce24ea..7f9202f 100644
> > --- a/functions
> > +++ b/functions
> > @@ -117,7 +117,7 @@ auto_modules() {
> >
> >     IFS=$'\n' read -rd '' -a mods < \
> >         <(find /sys/devices -name modalias -exec sort -u {} + |
> > -        xargs modprobe -d "$BASEDIR" -aRS "$KERNELVERSION" |
> > +        xargs -d $'\n' modprobe -d "$BASEDIR" -aRS "$KERNELVERSION" |
> Dollar sign what? /me doesn't follow this at all, a comment would be great.

consult your manual, sir!

  Words  of the form $'string' are treated specially. The word expands
  to string, with backslash-escaped characters replaced as specified by
  the ANSI C standard.  Backslash escape sequences, if present, are
  decoded.

In other words, its expanded in place. Yeah, this seems elementary to
me, but I suppose its comment worthy.

> >         sort -u)
> >
> >     printf "%s\n" "${mods[@]//-/_}"
> > --
> > 1.7.6.4
> >
> >


More information about the arch-projects mailing list