[Buildroot] [PATCH 1/1] fs/cpio/init: preserve arguments

Adrian Perez de Castro aperez at igalia.com
Wed Feb 21 23:21:34 UTC 2018


On Wed, 21 Feb 2018 23:43:32 +0100, Thomas Petazzoni <thomas.petazzoni at bootlin.com> wrote:
> Hello,
> 
> On Wed, 21 Feb 2018 16:02:16 -0500, Gaël PORTAY wrote:
> > Use "$@" instead of $* to preserve argument.
> 
> Thanks for your patch, but why ? The commit log needs to explain the
> use-case/motivations/reasons.

Using $* here will split each of the arguments at the spaces (well, at any of
the characters fro $IFS): that means that passing 'has space' as argument,
using $* will result in two arguments 'has' and 'space' being passed down.
Using "$@" prevents $IFS-splitting and passes argument unchanged as-is.

In most cases whenever there is a $* in a shell script, pretty much it means
that passing the parameters with spaces (file names, paths, etc.) will break
things.

Cheers,


--
 Adrián 🎩
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20180221/3604ce5f/attachment.asc>


More information about the buildroot mailing list