[PATCH libgpg-error] gpgrt-config: escape expr(1) operands
Roman Bogorodskiy
bogorodskiy at gmail.com
Sun Dec 9 10:08:21 CET 2018
With FreeBSD's expr(1), gpgrt-config prints the following:
$ PKG_CONFIG_LIBDIR=src ./src/gpgrt-config --libs
expr: illegal option -- L
expr: usage: expr [-e] expression
-L -lgpg-error
$
This happens because FreeBSD expr(1) makes no lexical distinction
between arguments which may be operators and arguments which
may be operands. [1]
To fix that, parenthesize values that could start with "-", as
suggested in the man page.
1: https://www.freebsd.org/cgi/man.cgi?query=expr&sektion=&n=1
---
src/gpgrt-config | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Note: there are similar invocations of expr(1) in gpgrt-config which
potentially could cause the same problem. However, I didn't touch those
because wasn't able to trigger these errors.
diff --git a/src/gpgrt-config b/src/gpgrt-config
index 3a76869..23b5ac7 100755
--- a/src/gpgrt-config
+++ b/src/gpgrt-config
@@ -404,7 +404,7 @@ sysroot () {
_result="$_result${_result:+ }$_opt"
shift
_result="$_result $PKG_CONFIG_SYSROOT_DIR$1"
- elif expr "$1" : "^$_opt" >/dev/null; then
+ elif expr "\( $1 \)" : "^$_opt" >/dev/null; then
_result="$_result${_result:+ }$_opt$PKG_CONFIG_SYSROOT_DIR$(expr "$1" : "^$_opt\(.*\)")"
else
_result="$_result${_result:+ }$1"
--
2.19.1
More information about the Gnupg-devel
mailing list