[Libguestfs] IRC question about consuming stdin

Richard W.M. Jones rjones at redhat.com
Sat Apr 4 15:20:03 UTC 2020


12:39 < eblake> rwmjones: 'nbdkit -s sh -' won't work, neither will 'nbdkit -s curl password=-'
12:40 < eblake> should we have an easier way for plugins to detect whether they can safely consume stdin and/or write to stdout during .config?
12:40 < eblake> and in turn, have nbdkit_read_password() check whether reading from stdin is safe?
12:40 < eblake> so that we fail fast rather than trying to get to .open
12:44 < eblake> I was trying to write a patch that would guarantee stdin/out are /dev/null from .open onwards, but found (the hard way) that we have several 
                instances where we depend on stdin/out interaction during .config (at least, when -s is not in use)
12:45 < eblake> right now, when nbdkit daemonizes, stdin/out are /dev/null, but with -f, or with --run, they are still whatever was passed to nbdkit, which feels 
                inconsistent
12:46 < eblake> and with -s, if the plugin accidentally uses stdin/out, it will corrupt the NBD protocol
12:49 < eblake> I'm wondering if we should add 'bool nbdkit_is_interactive()' [or better name] which returns false for -s, true otherwise, so .config can decide 
                when it is safe to consume stdin


(I haven't looked at this, but as my IRC access is for
some reason up and down today, it's probably best to
continue this discussion on email)

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/




More information about the Libguestfs mailing list