[pacman-dev] [PATCH] Provides generation for files (a.k.a. rpm fileattrs for makepkg)

Ralph Corderoy ralph at inputplus.co.uk
Mon Mar 9 09:55:13 UTC 2020


Hi Carsten,

> > > +                     for mimetype in "${mimetypes[@]}"; do
> > > +                             cleaned=$(echo $mimetype | xargs)
> >
> > What is "cleaned", and how is the xargs program "cleaning" it?
>
> Excess whitespace is being trimmed using xargs. "   a string " will
> get normalized to "a string" when passed through xargs.

That's not what actually happens; the whitespace is stripped before
being written down the pipe to xargs.

    $ mimetype='   a string '
    $ echo $mimetype | sed -n l
    a string$
    $

It's also ‘trimming’ internal whitespace, and I don't think that matches
the understood definition of trim.

    $ mimetype='   foo   bar  '
    $ echo $mimetype | sed -n l
    foo bar$
    $

Given this is bash, a built-in method may be more efficient.

-- 
Cheers, Ralph.


More information about the pacman-dev mailing list