On Mon, Apr 06, 2020 at 05:40:44PM +0200, Pino Toscano wrote:
Since this new temporary directory will contain UNIX sockets for
communicating with nbdkit, then its path must not be too long.
Use the existing directory that libguestfs exposes for this, i.e.
sockdir.
---
v2v/nbdkit.ml | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/v2v/nbdkit.ml b/v2v/nbdkit.ml
index 65317f9b..46b20c9d 100644
--- a/v2v/nbdkit.ml
+++ b/v2v/nbdkit.ml
@@ -103,9 +103,12 @@ let add_filter_if_available cmd filter =
if probe_filter filter then add_filter cmd filter else cmd
let run_unix cmd =
- (* Create a temporary directory where we place the socket and PID file. *)
+ (* Create a temporary directory where we place the socket and PID file.
+ * Use the libguestfs socket directory, so it is more likely the full path
+ * of the UNIX sockets will fit in the (limited) socket pathname.
+ *)
let tmpdir =
- let base_dir = (open_guestfs ())#get_cachedir () in
+ let base_dir = (open_guestfs ())#get_sockdir () in
let t = Mkdtemp.temp_dir ~base_dir "v2vnbdkit." in
(* tmpdir must be readable (but not writable) by "other" so that
* qemu can open the sockets.
Yes, this could be quite a serious bug if the temporary directory was
set to some long path -- it might even affect ‘make check’ in a
sufficiently deep subdirectory. ACK.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine. Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/