diff mbox

[v2] _require_command: fixed typo

Message ID 1431938861-8149-1-git-send-email-omzg@plexistor.com (mailing list archive)
State New, archived
Headers show

Commit Message

Omer Zilberberg May 18, 2015, 8:47 a.m. UTC
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>

v2: address Eryu's comment regarding quotation
---
 common/rc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Eryu Guan May 18, 2015, 8:53 a.m. UTC | #1
On Mon, May 18, 2015 at 11:47:41AM +0300, Omer Zilberberg wrote:
> 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>

Reviewed-by: Eryu Guan <eguan@redhat.com>

Thanks!

Eryu
> 
> v2: address Eryu's comment regarding quotation
> ---
>  common/rc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/common/rc b/common/rc
> index 6ea107e..68b07b8 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -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
>  }
> -- 
> 1.9.3
> 
--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/common/rc b/common/rc
index 6ea107e..68b07b8 100644
--- a/common/rc
+++ b/common/rc
@@ -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
 }