Received: from eggs.gnu.org ([2001:4830:134:3::10]:52364) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WrKpf-0002lg-QM for qemu-devel@nongnu.org; Mon, 02 Jun 2014 01:31:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WrKpT-0001Qw-5O for qemu-devel@nongnu.org; Mon, 02 Jun 2014 01:30:51 -0400 Received: from oxygen.pond.sub.org ([2a01:4f8:201:233:1::3]:45935) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WrKpS-0001Qe-Tz for qemu-devel@nongnu.org; Mon, 02 Jun 2014 01:30:39 -0400 Received: from blackfin.pond.sub.org (p5B329868.dip0.t-ipconnect.de [91.50.152.104]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by oxygen.pond.sub.org (Postfix) with ESMTPSA id 312BD248FA for ; Mon, 2 Jun 2014 07:30:38 +0200 (CEST) From: Markus Armbruster References: <1401564810-18798-1-git-send-email-mreitz@redhat.com> Date: Mon, 02 Jun 2014 07:30:37 +0200 In-Reply-To: <1401564810-18798-1-git-send-email-mreitz@redhat.com> (Max Reitz's message of "Sat, 31 May 2014 21:33:30 +0200") Message-ID: <87d2erev42.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH] qemu-img: Report error even with --oformat=json List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz Cc: Kevin Wolf , Federico Simoncelli , qemu-devel@nongnu.org, Stefan Hajnoczi Max Reitz writes: > img_check() should report that the format of the given image does not > support checks even if JSON output is desired. JSON data is output to > stdout, as opposed to error messages, which are (in the case of > qemu-img) printed to stderr. Therefore, it is easy to distinguish > between the two. > > Also, img_info() does already use error_report() for human-readable > messages even though JSON output is desired (through > collect_image_info_list()). > > Signed-off-by: Max Reitz > --- > As the old code deliberately emitted the error only in case of > human-readable output, I asked Federico, the original author, for his > opinion in https://bugzilla.redhat.com/show_bug.cgi?id=1054753, but did > not receive a reply so far. > --- > qemu-img.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/qemu-img.c b/qemu-img.c > index d118da5..b3d2bc6 100644 > --- a/qemu-img.c > +++ b/qemu-img.c > @@ -663,9 +663,7 @@ static int img_check(int argc, char **argv) > ret = collect_image_check(bs, check, filename, fmt, fix); > > if (ret == -ENOTSUP) { > - if (output_format == OFORMAT_HUMAN) { > - error_report("This image format does not support checks"); > - } > + error_report("This image format does not support checks"); > ret = 63; Undocumented return code. Care to fix that, too? > goto fail; > } Reviewed-by: Markus Armbruster