[Libguestfs] [PATCH nbdkit 1/2] server: Call .get_ready before redirecting stdin/stdout to /dev/null.

Eric Blake eblake at redhat.com
Wed Aug 5 13:08:53 UTC 2020


On 8/5/20 5:29 AM, Richard W.M. Jones wrote:
> VDDK plugin + --run was broken because of the following sequence of
> events:
> 
> (1) After .config_complete, server redirects stdin/stdout to /dev/null.
> 
> (2) Server then calls vddk_get_ready which reexecs.
> 
> (3) We restart the server from the top, but with stdin/stdout
>      redirected to /dev/null.  So saved_stdin/saved_stdout save
>      /dev/null.
> 
> (4) run_command is called which "restores" /dev/null as stdin/stdout.
> 
> (5) The output of the --run option is sent to /dev/null.
> 
> In addition to fixing this problem with VDDK, it also makes general
> sense not to redirect stdin/stdout before calling .get_ready since
> this callback is supposed to be the last chance before the server
> daemonizes, and redirecting stdin/stdout is part of daemonization.

It's been an interesting game of sequencing, but as we add more tests, 
we're certainly going to be more robust against future breakage ;)

Series looks good.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org




More information about the Libguestfs mailing list