[Buildroot] [PATCH 1/2] pkgconf: pkg-config.in: double quote $@
gael.portay at savoirfairelinux.com
Wed Feb 21 23:48:54 UTC 2018
On Wed, Feb 21, 2018 at 10:13:16PM +0100, Thomas Petazzoni wrote:
> On Wed, 21 Feb 2018 15:55:54 -0500, Gaël PORTAY wrote:
> > Double quote $@ to prevent from splitting elements.
> > Signed-off-by: Gaël PORTAY <gael.portay at savoirfairelinux.com>
> Could you give more details about what this is fixing, i.e a specific
> scenario that is fixed by this patch ?
In the case pkgconf, I can not see a real situation where this patch
fixes an issue.
There is an important difference between $@ and "$@". The shell expands
"$@" as "$1" "$2" "$3"... while it expands $@ as $1 $2 $3.
With the second form, we losts spaces in positional parameters.
As example, the following call
pkg-config --cflags "one two" three
is wrapped as
pkgconf --cflags one two three
while we are expecting
pkgconf --cflags "one two" three
"$@" is really useful when writing wrappers. It passes the positional
arguments *as* they are given.
> Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
> Embedded Linux and Kernel engineering
More information about the buildroot