[libvirt] [PATCH v1 0/2] Fix environment-setting code.

Richard W.M. Jones rjones at redhat.com
Mon Sep 24 18:54:36 UTC 2012


[This patch is for discussion only: I have not proven that
it fixes the bug]

https://bugzilla.redhat.com/show_bug.cgi?id=859596

When libvirtd runs any command, it uses a simple strategy to
set the environment for that command:

(a) It creates a new, empty environment array.

(b) It copies in a few known-good environment variables, including TMPDIR.

(c) It appends environment variables specified by the user, eg. ones
specified in <qemu:env>.

Unfortunately this means if you try to set TMPDIR via a <qemu:env> XML
directive, then it is appended to the list of environment variables
which already includes TMPDIR.  The qemu subprocess picks an
environment variable (probably) first from the list, which is the
TMPDIR that libvirtd had originally, not the TMPDIR that was specified
by the user.

This [possibly, not proven] leads to bug 859596, where we see qemu
trying to create temporary files in a directory that no longer exists.

The follow-up patches change libvirtd so that environment variables in
the virCommandPtr array are replaced if they exist already.

Rich.




More information about the libvir-list mailing list