Message ID | 1416278986-17320-1-git-send-email-famz@redhat.com |
---|---|
State | New |
Headers | show |
On 11/17/2014 07:49 PM, Fam Zheng wrote: > When which(1) is not installed, we complain "perl not found" because > it's the first set_prog_path check. The error message is misleading. > > Fix it by adding a check for which(1) in the beginning. Why not instead change set_prog_path to use 'command -v' instead of 'which'? As this is a bash script, we shouldn't need to shell out to an optional package for something we can do natively.
diff --git a/tests/qemu-iotests/common.config b/tests/qemu-iotests/common.config index bd6790b..9674f3a 100644 --- a/tests/qemu-iotests/common.config +++ b/tests/qemu-iotests/common.config @@ -73,6 +73,8 @@ _fatal() exit 1 } +which -v &>/dev/null || _fatal "which not found" + export PERL_PROG="`set_prog_path perl`" [ "$PERL_PROG" = "" ] && _fatal "perl not found"
When which(1) is not installed, we complain "perl not found" because it's the first set_prog_path check. The error message is misleading. Fix it by adding a check for which(1) in the beginning. Signed-off-by: Fam Zheng <famz@redhat.com> --- tests/qemu-iotests/common.config | 2 ++ 1 file changed, 2 insertions(+)