Skip to contentSkip to conversation

configure: fix check_min_lib_version() eval

PATCH Applied Stefan Hajnoczi 2 participants 2 messages May 6, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 configure: fix check_min_lib_version() eval

The following shell statement:

if eval "echo \$$_feature" = "yes" ; then

executes:

echo $... = "yes"

It does not actually compare the variable named by $_feature to the string "yes".

Add the missing "test" call so the comparison happens as intended and wrap the eval so it doesn't include the = "yes".

Fixes 3e48f7c9de61 ("configure: fix syntax error with NetBSD")
Cc Dmitry Fomichev <[email protected]>
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configure +1 -1
index a7d82be0..e886bdc8 100755
@@ -142,7 +142,7 @@ check_min_lib_version() {
   fi
   : "${_feature:=${1}}"
   if "${cross_prefix}"pkg-config --version > /dev/null 2>&1; then
-    if eval "echo \$$_feature" = "yes" ; then
+    if test "$(eval echo \"\$$_feature\")" = "yes" ; then
       feature_not_found "$_feature" "$1 >= $2"
     fi
   else
Signature · 1 line
2.31.1
Applied
#1 lore raw
Quoted 6 lines · Stefan Hajnoczi

The following shell statement:

if eval "echo \$$_feature" = "yes" ; then

executes:

Quoted 7 lines

echo $... = "yes"

It does not actually compare the variable named by $_feature to the string "yes".

Add the missing "test" call so the comparison happens as intended and wrap the eval so it doesn't include the = "yes".

Applied, thanks.

Signature · 1 line
Jens Axboe