Skip to contentSkip to conversation

_require_command: fixed typo

PATCH In review Omer Zilberberg 2 participants 2 messages May 18, 2015

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 _require_command: fixed typo

fixes 9435b92 common: _require_command needs to handle parameters

Also quoted $_command because _require_command may be called with an empty $1 parameter, e.g.:
_require_command "$MY_UTIL_PROG" my_util # but $MY_UTIL_PROG is empty

[ -x ] returns true.
[ -x "" ] returns false, as required here.

v2: address Eryu's comment regarding quotation

---
 common/rc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/rc +1 -1
index 6ea107e..68b07b8 100644
@@ -1299,7 +1299,7 @@ _require_command()
 	fi
 
 	_command=`echo "$1" | awk '{ print $1 }'`
-	if [ ! -x $command ]; then
+	if [ ! -x "$_command" ]; then
 		_notrun "$_name utility required, skipped this test"
 	fi
 }
Signature · 1 line
1.9.3
Reviewed-by on v2 1/1
#1 lore raw
Quoted 11 lines · Omer Zilberberg

fixes 9435b92 common: _require_command needs to handle parameters

Also quoted $_command because _require_command may be called with an empty $1 parameter, e.g.:
_require_command "$MY_UTIL_PROG" my_util # but $MY_UTIL_PROG is empty

[ -x ] returns true.
[ -x "" ] returns false, as required here.

Thanks!

Eryu

Quoted 22 lines

v2: address Eryu's comment regarding quotation

---
 common/rc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/rc +1 -1
index 6ea107e..68b07b8 100644
@@ -1299,7 +1299,7 @@ _require_command()
 	fi
 
 	_command=`echo "$1" | awk '{ print $1 }'`
-	if [ ! -x $command ]; then
+	if [ ! -x "$_command" ]; then
 		_notrun "$_name utility required, skipped this test"
 	fi
 }
Signature · 1 line
1.9.3