pkgconf: pkg-config.in: double quote $@
PATCH v2 1/2 pkgconf: pkg-config.in: double quote $@
The shell expands "$@" as "$1" "$2" "$3"... while it expands $@ as $1 $2 $3. With the second form, we loses 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.
Double quote $@ to prevent from splitting elements.
---
Changes since v1:
- improve commit message.
package/pkgconf/pkg-config.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
package/pkgconf/pkg-config.in +1 -1
@@ -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@ "$@"
Signature · 1 line
2.16.1
PATCH v2 2/2 pkgconf: pkg-config.in: exec pkgconf
Replace the shell script with pkgconf without creating a new process.
---
No changes since v1
package/pkgconf/pkg-config.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
package/pkgconf/pkg-config.in +1 -1
@@ -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@ "$@"
Signature · 1 line
2.16.1
PATCH v2 2/2 pkgconf: pkg-config.in: exec pkgconf
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Ga?l" == Ga?l PORTAY <[email protected]> writes:
Replace the shell script with pkgconf without creating a new process.
Signed-off-by Ga?l PORTAY <[email protected]>---
No changes since v1
Committed to 2018.02.x, thanks.
Signature · 1 line
Bye, Peter Korsgaard
PATCH v2 1/2 pkgconf: pkg-config.in: double quote $@
In reply to Gaël PORTAYHello,
Quoted 15 lines · Ga?l PORTAY
The shell expands "$@" as "$1" "$2" "$3"... while it expands $@ as $1 $2 $3. With the second form, we loses spaces in positional parameters.
As example, the following call
pkg-config --cflags "one two" threeis wrapped as
pkgconf --cflags one two threewhile we are expecting
pkgconf --cflags "one two" three
Quoted 7 lines
"$@" is really useful when writing wrappers. It passes the positional arguments *as* they are given.
Double quote $@ to prevent from splitting elements.
Signed-off-by Ga?l PORTAY <[email protected]>---
Both patches applied to next. Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com
PATCH v2 1/2 pkgconf: pkg-config.in: double quote $@
In reply to Gaël PORTAYQuoted 15 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Ga?l" == Ga?l PORTAY <[email protected]> writes:
The shell expands "$@" as "$1" "$2" "$3"... while it expands $@ as $1 $2 $3. With the second form, we loses spaces in positional parameters.
As example, the following call
pkg-config --cflags "one two" threeis wrapped as
pkgconf --cflags one two threewhile we are expecting
Quoted 8 lines
pkgconf --cflags "one two" three"$@" is really useful when writing wrappers. It passes the positional arguments *as* they are given.
Double quote $@ to prevent from splitting elements.
Signed-off-by Ga?l PORTAY <[email protected]>
Committed to 2018.02.x, thanks.
Signature · 1 line
Bye, Peter Korsgaard