From nobody Thu May 2 09:44:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 151784844310911.723490535746691; Mon, 5 Feb 2018 08:34:03 -0800 (PST) Received: from localhost ([::1]:60041 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eijiU-0004TR-5B for importer@patchew.org; Mon, 05 Feb 2018 11:34:02 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47033) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eijcb-0008Nz-3R for qemu-devel@nongnu.org; Mon, 05 Feb 2018 11:28:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eijca-00026g-4W for qemu-devel@nongnu.org; Mon, 05 Feb 2018 11:27:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46576) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eijcX-0001xT-Ax; Mon, 05 Feb 2018 11:27:53 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 715A97CB8B; Mon, 5 Feb 2018 16:27:52 +0000 (UTC) Received: from localhost (unknown [10.40.205.49]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CA81D5EDE6; Mon, 5 Feb 2018 16:27:46 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Mon, 5 Feb 2018 17:27:45 +0100 Message-Id: <20180205162745.23650-1-mreitz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 05 Feb 2018 16:27:52 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] qemu-img: Make resize error message more general X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=3D1523458 Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: John Snow --- 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 !=3D argc - 1) { - error_exit("Expecting one image file name"); + error_exit("Expecting image file name and size"); } filename =3D argv[optind++]; =20 --=20 2.14.3