All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/2] pkgconf: pkg-config.in: double quote $@
@ 2018-02-21 20:55 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
  0 siblings, 2 replies; 6+ messages in thread
From: Gaël PORTAY @ 2018-02-21 20:55 UTC (permalink / raw)
  To: buildroot

Double quote $@ to prevent from splitting elements.

Signed-off-by: Ga?l PORTAY <gael.portay@savoirfairelinux.com>
---
 package/pkgconf/pkg-config.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/pkgconf/pkg-config.in b/package/pkgconf/pkg-config.in
index b9ce0935cc..9387931ff2 100644
--- a/package/pkgconf/pkg-config.in
+++ b/package/pkgconf/pkg-config.in
@@ -2,4 +2,4 @@
 PKGCONFDIR=$(dirname $0)
 DEFAULT_PKG_CONFIG_LIBDIR=${PKGCONFDIR}/../@STAGING_SUBDIR@/usr/lib/pkgconfig:${PKGCONFDIR}/../@STAGING_SUBDIR@/usr/share/pkgconfig
 DEFAULT_PKG_CONFIG_SYSROOT_DIR=${PKGCONFDIR}/../@STAGING_SUBDIR@
-PKG_CONFIG_LIBDIR=${PKG_CONFIG_LIBDIR:-${DEFAULT_PKG_CONFIG_LIBDIR}} PKG_CONFIG_SYSROOT_DIR=${PKG_CONFIG_SYSROOT_DIR:-${DEFAULT_PKG_CONFIG_SYSROOT_DIR}} ${PKGCONFDIR}/pkgconf @STATIC@ $@
+PKG_CONFIG_LIBDIR=${PKG_CONFIG_LIBDIR:-${DEFAULT_PKG_CONFIG_LIBDIR}} PKG_CONFIG_SYSROOT_DIR=${PKG_CONFIG_SYSROOT_DIR:-${DEFAULT_PKG_CONFIG_SYSROOT_DIR}} ${PKGCONFDIR}/pkgconf @STATIC@ "$@"
-- 
2.16.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH 2/2] pkgconf: pkg-config.in: exec pkgconf
  2018-02-21 20:55 [Buildroot] [PATCH 1/2] pkgconf: pkg-config.in: double quote $@ Gaël PORTAY
@ 2018-02-21 20:55 ` Gaël PORTAY
  2018-02-21 21:13 ` [Buildroot] [PATCH 1/2] pkgconf: pkg-config.in: double quote $@ Thomas Petazzoni
  1 sibling, 0 replies; 6+ messages in thread
From: Gaël PORTAY @ 2018-02-21 20:55 UTC (permalink / raw)
  To: buildroot

Replace the shell script with pkgconf without creating a new process.

Signed-off-by: Ga?l PORTAY <gael.portay@savoirfairelinux.com>
---
 package/pkgconf/pkg-config.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/pkgconf/pkg-config.in b/package/pkgconf/pkg-config.in
index 9387931ff2..99c0add8fb 100644
--- a/package/pkgconf/pkg-config.in
+++ b/package/pkgconf/pkg-config.in
@@ -2,4 +2,4 @@
 PKGCONFDIR=$(dirname $0)
 DEFAULT_PKG_CONFIG_LIBDIR=${PKGCONFDIR}/../@STAGING_SUBDIR@/usr/lib/pkgconfig:${PKGCONFDIR}/../@STAGING_SUBDIR@/usr/share/pkgconfig
 DEFAULT_PKG_CONFIG_SYSROOT_DIR=${PKGCONFDIR}/../@STAGING_SUBDIR@
-PKG_CONFIG_LIBDIR=${PKG_CONFIG_LIBDIR:-${DEFAULT_PKG_CONFIG_LIBDIR}} PKG_CONFIG_SYSROOT_DIR=${PKG_CONFIG_SYSROOT_DIR:-${DEFAULT_PKG_CONFIG_SYSROOT_DIR}} ${PKGCONFDIR}/pkgconf @STATIC@ "$@"
+PKG_CONFIG_LIBDIR=${PKG_CONFIG_LIBDIR:-${DEFAULT_PKG_CONFIG_LIBDIR}} PKG_CONFIG_SYSROOT_DIR=${PKG_CONFIG_SYSROOT_DIR:-${DEFAULT_PKG_CONFIG_SYSROOT_DIR}} exec ${PKGCONFDIR}/pkgconf @STATIC@ "$@"
-- 
2.16.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH 1/2] pkgconf: pkg-config.in: double quote $@
  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 ` Thomas Petazzoni
  2018-02-21 23:48   ` Gaël PORTAY
  1 sibling, 1 reply; 6+ messages in thread
From: Thomas Petazzoni @ 2018-02-21 21:13 UTC (permalink / raw)
  To: buildroot

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 ?

Thanks!

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH 1/2] pkgconf: pkg-config.in: double quote $@
  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
  2018-02-22 15:49     ` Thomas Petazzoni
  0 siblings, 1 reply; 6+ messages in thread
From: Gaël PORTAY @ 2018-02-21 23:48 UTC (permalink / raw)
  To: buildroot

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH 1/2] pkgconf: pkg-config.in: double quote $@
  2018-02-21 23:48   ` Gaël PORTAY
@ 2018-02-22 15:49     ` Thomas Petazzoni
  2018-02-22 15:57       ` Gaël PORTAY
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Petazzoni @ 2018-02-22 15:49 UTC (permalink / raw)
  To: buildroot

Hello,

On Wed, 21 Feb 2018 18:48:54 -0500, Ga?l PORTAY wrote:

> > 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.

OK, thanks for the explanation, makes sense. A better commit log would
definitely help :)

Thanks!

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH 1/2] pkgconf: pkg-config.in: double quote $@
  2018-02-22 15:49     ` Thomas Petazzoni
@ 2018-02-22 15:57       ` Gaël PORTAY
  0 siblings, 0 replies; 6+ messages in thread
From: Gaël PORTAY @ 2018-02-22 15:57 UTC (permalink / raw)
  To: buildroot

On Thu, Feb 22, 2018 at 04:49:49PM +0100, Thomas Petazzoni wrote:
> ...
> 
> OK, thanks for the explanation, makes sense. A better commit log would
> definitely help :)
>

I am rewording the commit message to include that explanation. And I
will resend the patch.

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

Gael

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-02-22 15:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2018-02-22 15:49     ` Thomas Petazzoni
2018-02-22 15:57       ` Gaël PORTAY

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.