On Wed, Jul 24, 2024 at 04:04:58PM -0500, Eric Blake wrote:
On Tue, Jul 23, 2024 at 05:30:12PM GMT, Richard W.M. Jones wrote:
> Print the full error from the server during handshaking. This
> modifies the contract of handle_reply_error so it calls set_error,
> which can be overridden by callers or ignored completely.
> ---
> generator/states-newstyle-opt-go.c | 32 +---------
> generator/states-newstyle-opt-list.c | 5 +-
> generator/states-newstyle-opt-meta-context.c | 8 +--
> generator/states-newstyle.c | 62 ++++++++++++++++++--
> 4 files changed, 63 insertions(+), 44 deletions(-)
This refactoring makes sense to get at the server's message (qemu
already sends such messages, and I see your other thread on teaching
nbdkit to do the same). ACK series.
Thanks, I pushed this as 9d1a65d0e..474a4ae6c.
One problem with this is that we take the server's (ie. untrusted)
string and create an error message from it. Most libnbd callers write
these errors to stderr directly. Thus server output can be
interpreted by the terminal.
This is also a problem in current qemu actually:
$ nbdkit --log=null eval open=' printf "EPERM x\\r mess up the output mess up the
output mess up the output" >&2; exit 1 ' get_size=' echo 0 '
--run 'qemu-img info "$uri"'
qemu-img: Could not open 'nbd+unix://?socket=/tmp/nbdkitUO2nYZ/socket': Requested
export not available
mess up the output mess up the output mess up the output
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
libguestfs lets you edit virtual machines. Supports shell scripting,
bindings from many languages.
http://libguestfs.org