On Tue, Oct 10, 2023 at 09:05:43AM +0200, Laszlo Ersek wrote:
> On 10/9/23 16:51, Richard W.M. Jones wrote:
> > 
> > So one thing we could do for this test is to require (for the test)
> > that /bin/sh is bash, something like the patch below.  I was only able
> > to test this in the positive case.
> > 
> > diff --git a/tests/test-log-script-info.sh b/tests/test-log-script-info.sh
> > index fa9b2ed32..d65f6415d 100755
> > --- a/tests/test-log-script-info.sh
> > +++ b/tests/test-log-script-info.sh
> > @@ -38,6 +38,10 @@ requires_run
> >  requires_nbdinfo
> >  requires_filter log
> >  
> > +# This test implicitly assumes /bin/sh is bash, see:
> > +# https://listman.redhat.com/archives/libguestfs/2023-October/032767.html
> > +BASH_VERSION=no requires /bin/sh -c 'test "x$BASH_VERSION" != "xno"'
> > +
> >  if ! nbdinfo --help | grep -- --map ; then
> >      echo "$0: nbdinfo --map option required to run this test"
> >      exit 77
> > 
> > 
> 
> Clever!
> 
> Reviewed-by: Laszlo Ersek <ler...@redhat.com>
> 
> You can test it with "dash" BTW (it must be available in Fedora, because
> it is available in EPEL-9):
> 
> BASH_VERSION=no /bin/bash -c 'test "x$BASH_VERSION" != "xno"; echo $?'
> BASH_VERSION=no /bin/dash -c 'test "x$BASH_VERSION" != "xno"; echo $?'

Thanks - after testing with dash as you suggested, I pushed this
change which is similar in spirit:

https://gitlab.com/nbdkit/nbdkit/-/commit/99712c09835ae430912aed4848579fdfab01a576

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html
_______________________________________________
Libguestfs mailing list
Libguestfs@redhat.com
https://listman.redhat.com/mailman/listinfo/libguestfs

Reply via email to