[PATCH libgpg-error] gpgrt-config: escape expr(1) operands
NIIBE Yutaka
gniibe at fsij.org
Mon Dec 10 01:12:09 CET 2018
Roman Bogorodskiy <bogorodskiy at gmail.com> wrote:
> With FreeBSD's expr(1), gpgrt-config prints the following:
[...]
> 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.
Thank you.
> --- 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
Here, the expression is to match string of $1 against $_opt. IIUC,
while this fix indeed escapes $1, I'm afraid it changes the semantics.
I fix it in a different way, by adding "x" to the expression. I also
fix another portability problem of expr.
--
More information about the Gnupg-devel
mailing list