qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Nir Soffer <nirsof@gmail.com>, qemu-devel@nongnu.org
Cc: Nir Soffer <nsoffer@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] qemu-io: Return non-zero exit code on failure
Date: Wed, 11 Jan 2017 15:51:05 -0600	[thread overview]
Message-ID: <750c2d41-dac2-61f7-29c3-82d8d13a0de6@redhat.com> (raw)
In-Reply-To: <20170111182455.15160-1-nirsof@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1278 bytes --]

On 01/11/2017 12:24 PM, Nir Soffer wrote:
> From: Nir Soffer <nsoffer@redhat.com>
> 
> The result of openfile was not checked, leading to failure deep in the
> actual command with confusing error message, and exiting with exit code 0.
> 
> Here is one example - trying to read a pattern from an invalid chain:
> 
>     $ qemu-io -c 'read -P 1 0 1024' top.qcow2; echo $?

As written, you have to guess some context about how top.qcow2 was
created.  The example can be made a bit more reproducible with:

$ : > file
$ qemu-io -f qcow2 -c ... file

>     can't open device top.qcow2: Could not open backing file: Image is not in qcow2 format
>     no file open, try 'help open'
>     0
> 
> With this patch, we fail earlier with exit code 1:
> 
>     $ ./qemu-io -c 'read -P 1 0 1024' top.qcow2; echo $?
>     can't open device top.qcow2: Could not open backing file: Image is not
>     in qcow2 format
>     1
> 
> Signed-off-by: Nir Soffer <nirsof@gmail.com>
> ---
>  qemu-io.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)

Whether or not the commit message is improved,
Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2017-01-11 21:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-11 18:24 [Qemu-devel] [PATCH] qemu-io: Return non-zero exit code on failure Nir Soffer
2017-01-11 21:51 ` Eric Blake [this message]
2017-01-12  3:01   ` Fam Zheng
2017-01-12 20:04     ` Nir Soffer
2017-01-12 19:56   ` Nir Soffer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=750c2d41-dac2-61f7-29c3-82d8d13a0de6@redhat.com \
    --to=eblake@redhat.com \
    --cc=nirsof@gmail.com \
    --cc=nsoffer@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).