qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Max Reitz <mreitz@redhat.com>, qemu-block@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] qemu-img: Make resize error message more general
Date: Mon, 5 Feb 2018 13:24:33 -0600	[thread overview]
Message-ID: <73421d5f-c40b-bc7d-6da4-6c129db53696@redhat.com> (raw)
In-Reply-To: <20180205162745.23650-1-mreitz@redhat.com>

On 02/05/2018 10:27 AM, Max Reitz wrote:
> The issue:
> 
>    $ qemu-img resize -f qcow2 foo.qcow2
>    qemu-img: Expecting one image file name
>    Try 'qemu-img --help' for more information
> 
> So we gave an image file name, but we omitted the length.  qemu-img
> thinks the last argument is always the size and removes it immediately
> from argv (by decrementing argc), and tries to verify that it is a valid
> size only at a later point.
> 
> So we do not actually know whether that last argument we called "size"
> is indeed a size or whether the user instead forgot to specify that size
> but did give a file name.
> 
> Therefore, the error message should be more general.
> 
> Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1523458
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>   qemu-img.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/qemu-img.c b/qemu-img.c
> index 68b375f998..2753b63514 100644
> --- a/qemu-img.c
> +++ b/qemu-img.c
> @@ -3468,7 +3468,7 @@ static int img_resize(int argc, char **argv)
>           }
>       }
>       if (optind != argc - 1) {
> -        error_exit("Expecting one image file name");
> +        error_exit("Expecting image file name and size");

Yes, that reads better in the context you described.

Reviewed-by: Eric Blake <eblake@redhat.com>

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

  parent reply	other threads:[~2018-02-05 19:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-05 16:27 [Qemu-devel] [PATCH] qemu-img: Make resize error message more general Max Reitz
2018-02-05 18:55 ` [Qemu-devel] [Qemu-block] " John Snow
2018-02-05 19:24 ` Eric Blake [this message]
2018-02-23 13:50 ` [Qemu-devel] " Max Reitz

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=73421d5f-c40b-bc7d-6da4-6c129db53696@redhat.com \
    --to=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --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).