[U-Boot] [PATCH V2 3/3] fs-test.sh: fix pre-requisite detection

2015-10-03 Thread Stephen Warren
In the following snippet:

if [ ! -x `which $prereq` ]; then

When $prereq does not exist, `which $prereq` evaluates to the empty string,
which results in *no* argument being passed to the -x operator, which then
evaluates to true, which is the equivalent of the prereq having been found. In
order for this to fail as expected, we must pass an empty argument, which then
causes -x to fail. Do this by wrapping the `` in quotes so there's always an
argument to -x, even if the value of the argument is zero-length.

Signed-off-by: Stephen Warren 
---
v2: New patch.
---
 test/fs/fs-test.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/fs/fs-test.sh b/test/fs/fs-test.sh
index b88a67ca066d..a4200964355e 100755
--- a/test/fs/fs-test.sh
+++ b/test/fs/fs-test.sh
@@ -58,7 +58,7 @@ GB2p5="${MOUNT_DIR}/${BIG_FILE}"
 # Check if the prereq binaries exist, or exit
 function check_prereq() {
for prereq in $PREREQ_BINS; do
-   if [ ! -x `which $prereq` ]; then
+   if [ ! -x "`which $prereq`" ]; then
echo "Missing $prereq binary. Exiting!"
exit
fi
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH V2 3/3] fs-test.sh: fix pre-requisite detection

2015-10-06 Thread Simon Glass
On 3 October 2015 at 20:56, Stephen Warren  wrote:
> In the following snippet:
>
> if [ ! -x `which $prereq` ]; then
>
> When $prereq does not exist, `which $prereq` evaluates to the empty string,
> which results in *no* argument being passed to the -x operator, which then
> evaluates to true, which is the equivalent of the prereq having been found. In
> order for this to fail as expected, we must pass an empty argument, which then
> causes -x to fail. Do this by wrapping the `` in quotes so there's always an
> argument to -x, even if the value of the argument is zero-length.
>
> Signed-off-by: Stephen Warren 
> ---
> v2: New patch.
> ---
>  test/fs/fs-test.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Simon Glass 
Tested-by: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot