]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
_require_command: quote commands correctly
authorOmer Zilberberg <omzg@plexistor.com>
Tue, 26 May 2015 02:51:57 +0000 (12:51 +1000)
committerDave Chinner <david@fromorbit.com>
Tue, 26 May 2015 02:51:57 +0000 (12:51 +1000)
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.

Signed-off-by: Omer Zilberberg <omzg@plexistor.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
common/rc

index 900b6e557e45cc3231dbed43e289304d3d36e447..c31538dec96d618ab49a673901cbe901af38e2ab 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -1307,7 +1307,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
 }