[Libguestfs] [libnbd PATCH 07/20] tests: Fix port randomisation

Eric Blake eblake at redhat.com
Tue Jun 8 12:49:38 UTC 2021


On Tue, Jun 08, 2021 at 09:53:48AM +0200, Martin Kletzander wrote:
> The shell/environment variable `$RANDOM` is not defined POSIX, so let bash
> evaluate the whole expression by changing double quotes to single quotes.
> 
> Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
> ---
>  tests/Makefile.am | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/Makefile.am b/tests/Makefile.am
> index 6a3a1f092572..c65bf8be399e 100644
> --- a/tests/Makefile.am
> +++ b/tests/Makefile.am
> @@ -608,7 +608,7 @@ TESTS += \
>  	connect-uri-nbd-unix \
>  	$(NULL)
>  
> -RANDOM1 := $(shell bash -c "echo $$(( 32768 + (RANDOM & 16383) ))")
> +RANDOM1 := $(shell bash -c 'echo $$(( 32768 + (RANDOM & 16383) ))')

ACK. We absolutely want the $(()) run by bash, not by the shell
invoking bash ;)

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org




More information about the Libguestfs mailing list