Richard W.M. Jones
2018-Jun-06 18:36 UTC
[Libguestfs] [PATCH] tests: Provide full path to Unix domain sockets.
Maybe a bug in libvirt? https://www.redhat.com/archives/libvir-list/2018-June/msg00490.html --- tests/test-cache.sh | 3 ++- tests/test-cow.sh | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/test-cache.sh b/tests/test-cache.sh index e5e9e82..ac99ce2 100755 --- a/tests/test-cache.sh +++ b/tests/test-cache.sh @@ -32,6 +32,7 @@ # SUCH DAMAGE. set -e +set -x files="cache.img cache.sock cache.pid" rm -f $files @@ -69,7 +70,7 @@ cleanup () trap cleanup INT QUIT TERM EXIT ERR # Open the overlay and perform some operations. -guestfish --format=raw -a 'nbd://?socket=cache.sock' <<'EOF' +guestfish --format=raw -a "nbd://?socket=`pwd`/cache.sock" <<'EOF' run part-disk /dev/sda gpt mkfs ext4 /dev/sda1 diff --git a/tests/test-cow.sh b/tests/test-cow.sh index 443ba38..4b798c8 100755 --- a/tests/test-cow.sh +++ b/tests/test-cow.sh @@ -32,6 +32,7 @@ # SUCH DAMAGE. set -e +set -x files="cow-base.img cow-diff.qcow2 cow.sock cow.pid" rm -f $files @@ -70,7 +71,7 @@ cleanup () trap cleanup INT QUIT TERM EXIT ERR # Write some data into the overlay. -guestfish --format=raw -a 'nbd://?socket=cow.sock' -m /dev/sda1 <<EOF +guestfish --format=raw -a "nbd://?socket=`pwd`/cow.sock" -m /dev/sda1 <<EOF fill-dir / 10000 fill-pattern "abcde" 5M /large write /hello "hello, world" -- 2.16.2
Eric Blake
2018-Jun-06 18:48 UTC
Re: [Libguestfs] [PATCH] tests: Provide full path to Unix domain sockets.
On 06/06/2018 01:36 PM, Richard W.M. Jones wrote:> Maybe a bug in libvirt? > https://www.redhat.com/archives/libvir-list/2018-June/msg00490.htmlOr maybe intentional. Using absolute paths is better than assuming that libvirt will treat relative paths against the same directory as you intended; although it would be nicer if libvirt would reject XML with a relative path up front rather than look in the wrong directory and perhaps succeed by accident on the wrong file.> --- > tests/test-cache.sh | 3 ++- > tests/test-cow.sh | 3 ++- > 2 files changed, 4 insertions(+), 2 deletions(-)> @@ -69,7 +70,7 @@ cleanup () > trap cleanup INT QUIT TERM EXIT ERR > > # Open the overlay and perform some operations. > -guestfish --format=raw -a 'nbd://?socket=cache.sock' <<'EOF' > +guestfish --format=raw -a "nbd://?socket=`pwd`/cache.sock" <<'EOF'We're using bash, so save a fork, by using $PWD instead of `pwd`. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Richard W.M. Jones
2018-Jun-06 18:55 UTC
Re: [Libguestfs] [PATCH] tests: Provide full path to Unix domain sockets.
On Wed, Jun 06, 2018 at 01:48:56PM -0500, Eric Blake wrote:> On 06/06/2018 01:36 PM, Richard W.M. Jones wrote: > >Maybe a bug in libvirt? > >https://www.redhat.com/archives/libvir-list/2018-June/msg00490.html > > Or maybe intentional. Using absolute paths is better than assuming > that libvirt will treat relative paths against the same directory as > you intended; although it would be nicer if libvirt would reject XML > with a relative path up front rather than look in the wrong > directory and perhaps succeed by accident on the wrong file. > > >--- > > tests/test-cache.sh | 3 ++- > > tests/test-cow.sh | 3 ++- > > 2 files changed, 4 insertions(+), 2 deletions(-) > > >@@ -69,7 +70,7 @@ cleanup () > > trap cleanup INT QUIT TERM EXIT ERR > > # Open the overlay and perform some operations. > >-guestfish --format=raw -a 'nbd://?socket=cache.sock' <<'EOF' > >+guestfish --format=raw -a "nbd://?socket=`pwd`/cache.sock" <<'EOF' > > We're using bash, so save a fork, by using $PWD instead of `pwd`.Thanks, I pushed it using $PWD and a more neutral commit message. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org