On Tuesday 29 September 2015 12:54:47 Richard W.M. Jones wrote:
Commits 3c27f3d91e1566854747bbe844186783fc84f3a8 and
1b6f0daa9ae7fcc94e389232d0c397816cda973d added an internal API for
running commands asynchronously. It is only used by the copy-in and
copy-out APIs.
Unfortunately this made the command code very complex: it was almost
impossible to redirect stderr to a file, and there were a lot of
long-range dependencies through the file. It was also buggy: it set
up stderr of the child process pointing pipe, but never read from the
pipe, so if the stderr output of the child process was sufficiently
large then libguestfs would deadlock (possibly this can be triggered
from a malicious filesystem too).
This patch series first reverts these commits, then adds a simpler way
to run a child process without waiting (modelled on popen()), allows
stderr errors to be captured, then reimplements copy-in/copy-out using
these new internal APIs.
Note that the patch series breaks bisection, but I can't really think
of a clearer way to reorganize it that would preserve bisection.
LGTM.
--
Pino Toscano