From 4695c75036bb6c632baa646e4dd2d084d81b23f7 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 9 Aug 2022 07:48:25 -0700 Subject: [PATCH 2/2] Avoid undefined \- in regexp * configure.ac, libiberty/configure.ac: (AR_PLUGIN_OPTION, RANLIB_PLUGIN_OPTION): Don't use 'grep "\-..."' as POSIX says the interpretation of \- is undefined in a regular expression. --- ChangeLog | 8 ++++++++ configure.ac | 4 ++-- libiberty/configure.ac | 4 ++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8a84e119e53..44b4233bde6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2022-08-09 Paul Eggert + + Avoid undefined \- in regexp + * configure.ac, libiberty/configure.ac: + (AR_PLUGIN_OPTION, RANLIB_PLUGIN_OPTION): + Don't use 'grep "\-..."' as POSIX says the interpretation + of \- is undefined in a regular expression. + 2022-07-08 Nick Clifton * 2.39 branch created. diff --git a/configure.ac b/configure.ac index 1651cbf3b02..4738294dbd9 100644 --- a/configure.ac +++ b/configure.ac @@ -3475,10 +3475,10 @@ GCC_PLUGIN_OPTION(PLUGIN_OPTION) AR_PLUGIN_OPTION= RANLIB_PLUGIN_OPTION= if test -n "$PLUGIN_OPTION"; then - if $AR --help 2>&1 | grep -q "\--plugin"; then + if $AR --help 2>&1 | grep -q "[-]-plugin"; then AR_PLUGIN_OPTION="$PLUGIN_OPTION" fi - if $RANLIB --help 2>&1 | grep -q "\--plugin"; then + if $RANLIB --help 2>&1 | grep -q "[-]-plugin"; then RANLIB_PLUGIN_OPTION="$PLUGIN_OPTION" fi else diff --git a/libiberty/configure.ac b/libiberty/configure.ac index 6c1ff9c6093..28933d5fcc1 100644 --- a/libiberty/configure.ac +++ b/libiberty/configure.ac @@ -116,11 +116,11 @@ AC_CHECK_TOOL(RANLIB, ranlib, :) GCC_PLUGIN_OPTION(PLUGIN_OPTION) if test -n "$PLUGIN_OPTION"; then - if $AR --help 2>&1 | grep -q "\--plugin"; then + if $AR --help 2>&1 | grep -q "[-]-plugin"; then AR_PLUGIN_OPTION="$PLUGIN_OPTION" AC_SUBST(AR_PLUGIN_OPTION) fi - if $RANLIB --help 2>&1 | grep -q "\--plugin"; then + if $RANLIB --help 2>&1 | grep -q "[-]-plugin"; then RANLIB_PLUGIN_OPTION="$PLUGIN_OPTION" AC_SUBST(RANLIB_PLUGIN_OPTION) fi -- 2.37.1