From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41211) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNdMl-0000s7-QR for qemu-devel@nongnu.org; Tue, 17 Feb 2015 03:18:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YNdMf-00033y-NC for qemu-devel@nongnu.org; Tue, 17 Feb 2015 03:18:47 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37958) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNdMf-00033u-F1 for qemu-devel@nongnu.org; Tue, 17 Feb 2015 03:18:41 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t1H8Iext026414 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 17 Feb 2015 03:18:41 -0500 From: Markus Armbruster References: <1424097865-3973-1-git-send-email-armbru@redhat.com> <1424097865-3973-5-git-send-email-armbru@redhat.com> <54E250CB.1050008@redhat.com> Date: Tue, 17 Feb 2015 09:18:38 +0100 In-Reply-To: <54E250CB.1050008@redhat.com> (John Snow's message of "Mon, 16 Feb 2015 15:19:23 -0500") Message-ID: <87d259ne75.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 04/13] qemu-img: Suppress unhelpful extra errors in convert, resize List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: John Snow Cc: kwolf@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com, kraxel@redhat.com John Snow writes: > On 02/16/2015 09:44 AM, Markus Armbruster wrote: >> add_old_style_options() for img_convert() and img_resize() use >> qemu_opt_set(), which reports errors with qerror_report_err(). Its >> error messages aren't helpful here, the caller reports one that >> actually makes sense. Reproducer: >> >> $ qemu-img convert -B raw in.img out.img >> qemu-img: Invalid parameter 'backing_file' >> qemu-img: Backing file not supported for file format 'raw' >> >> Switch to qemu_opt_set_err() to get rid of the unwanted messages. >> >> Signed-off-by: Markus Armbruster >> --- >> qemu-img.c | 16 ++++++++++++---- >> 1 file changed, 12 insertions(+), 4 deletions(-) >> >> diff --git a/qemu-img.c b/qemu-img.c >> index 7eea84a..7a806bc 100644 >> --- a/qemu-img.c >> +++ b/qemu-img.c [...] >> @@ -2830,8 +2837,9 @@ static int img_resize(int argc, char **argv) >> >> /* Parse size */ >> param =3D qemu_opts_create(&resize_options, NULL, 0, &error_abort); >> - if (qemu_opt_set(param, BLOCK_OPT_SIZE, size)) { >> - /* Error message already printed when size parsing fails */ >> + qemu_opt_set_err(param, BLOCK_OPT_SIZE, size, &err); >> + if (err) { >> + error_report_err(err); > > Creates a new warning/failure for me, if basing off of origin/master > or kevin/block: > > CC qemu-img.o > /home/bos/jhuston/src/qemu/qemu-img.c: In function =E2=80=98img_resize=E2= =80=99: > /home/bos/jhuston/src/qemu/qemu-img.c:2844:9: error: implicit > declaration of function =E2=80=98error_report_err=E2=80=99 > [-Werror=3Dimplicit-function-declaration] > error_report_err(err); > ^ > /home/bos/jhuston/src/qemu/qemu-img.c:2844:9: error: nested extern > declaration of =E2=80=98error_report_err=E2=80=99 [-Werror=3Dnested-exter= ns] > cc1: all warnings being treated as errors > make: *** [qemu-img.o] Error 1 > make: *** Waiting for unfinished jobs.... You need my "[PATCH v2 01/10] error: New convenience function error_report_err()", but I forgot to mention it in my cover letter. My apologies. [...]