All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Gaël PORTAY" <gael.portay@savoirfairelinux.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 1/2] pkgconf: pkg-config.in: double quote $@
Date: Wed, 21 Feb 2018 18:48:54 -0500	[thread overview]
Message-ID: <20180221234854.u46pcpr4heesrzim@archlinux> (raw)
In-Reply-To: <20180221221316.5ff3a77a@windsurf.lan>

Thomas,

On Wed, Feb 21, 2018 at 10:13:16PM +0100, Thomas Petazzoni wrote:
> Hello,
> 
> 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@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.

> 
> Thanks!
> 
> Thomas
> -- 
> Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
> Embedded Linux and Kernel engineering
> http://bootlin.com

Regards,
Gael

  reply	other threads:[~2018-02-21 23:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-21 20:55 [Buildroot] [PATCH 1/2] pkgconf: pkg-config.in: double quote $@ Gaël PORTAY
2018-02-21 20:55 ` [Buildroot] [PATCH 2/2] pkgconf: pkg-config.in: exec pkgconf Gaël PORTAY
2018-02-21 21:13 ` [Buildroot] [PATCH 1/2] pkgconf: pkg-config.in: double quote $@ Thomas Petazzoni
2018-02-21 23:48   ` Gaël PORTAY [this message]
2018-02-22 15:49     ` Thomas Petazzoni
2018-02-22 15:57       ` Gaël PORTAY

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180221234854.u46pcpr4heesrzim@archlinux \
    --to=gael.portay@savoirfairelinux.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.