Re: [PATCH] Make test for gnuplot work with empty strings.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Mar 11 2013, Martin Steigerwald wrote:
> When I launch fio_generate_plots on a system where gnuplot is not installed I
> get this error :
> 
> $ fio_generate_plots test
> Making bw logs
> /usr/bin/fio_generate_plots: 42: /usr/bin/fio_generate_plots: -: not found
> 
> That's because the test checking whether gnuplot is installed is failing
> because of an empty variable :
> GNUPLOT=$(which gnuplot)
> if [ ! -x $GNUPLOT ]; then
>         echo You need gnuplot installed to generate graphs
>         exit 1
> fi
> 
> Indeed the command "test -x" is exiting with code 0.
> 
> To correct this we should enclose the variable with quotes :
> if [ ! -x "$GNUPLOT" ]; then
> 
> Then the script is going into the test properly :
> $ fio_generate_plots test
> You need gnuplot installed to generate graphs
> 
> I copied problem description by Hervé from the Debian bug report below.
> 
> Fixes:
> Bug#700580: /usr/bin/fio_generate_plots: -: not found
> http://bugs.debian.org/700580
> 
> Reported-By: Hervé Werner <hwerner@xxxxxxxxxxxx>
> Tested-By: Hervé Werner <hwerner@xxxxxxxxxxxx>
> Tested-By: Martin Steigerwald <ms@xxxxxxxxx>
> ---
>  fio_generate_plots |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fio_generate_plots b/fio_generate_plots
> index 4285415..5e2febd 100755
> --- a/fio_generate_plots
> +++ b/fio_generate_plots
> @@ -8,7 +8,7 @@ if [ "$1"x = "x" ]; then
>  fi
>  
>  GNUPLOT=$(which gnuplot)
> -if [ ! -x $GNUPLOT ]; then
> +if [ ! -x "$GNUPLOT" ]; then
>  	echo You need gnuplot installed to generate graphs
>  	exit 1
>  fi

Thanks, obviously correct :-)

-- 
Jens Axboe

--
To unsubscribe from this list: send the line "unsubscribe fio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Linux SCSI]     [Linux IDE]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux