Received: from list by lists.gnu.org with archive (Exim 4.71) id 1U3tiS-0008Re-N2 for mharc-qemu-trivial@gnu.org; Fri, 08 Feb 2013 14:34:32 -0500 Received: from eggs.gnu.org ([208.118.235.92]:53610) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U3tiO-0008Kh-N4 for qemu-trivial@nongnu.org; Fri, 08 Feb 2013 14:34:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U3tiN-0007kL-DF for qemu-trivial@nongnu.org; Fri, 08 Feb 2013 14:34:28 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46163) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U3tiK-0007jl-Ss; Fri, 08 Feb 2013 14:34:25 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r18JYMJp013416 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 8 Feb 2013 14:34:22 -0500 Received: from blackfin.pond.sub.org (ovpn-116-59.ams2.redhat.com [10.36.116.59]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r18JYLwM007242; Fri, 8 Feb 2013 14:34:21 -0500 Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id AFFBF200AA; Fri, 8 Feb 2013 20:34:20 +0100 (CET) From: Markus Armbruster To: Luiz Capitulino References: <1360340232-4670-1-git-send-email-armbru@redhat.com> <1360340232-4670-5-git-send-email-armbru@redhat.com> <20130208155324.0c456dcc@redhat.com> <87sj56d44d.fsf@blackfin.pond.sub.org> <20130208171630.3deddd59@redhat.com> Date: Fri, 08 Feb 2013 20:34:20 +0100 In-Reply-To: <20130208171630.3deddd59@redhat.com> (Luiz Capitulino's message of "Fri, 8 Feb 2013 17:16:30 -0200") Message-ID: <878v6y7g77.fsf@blackfin.pond.sub.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: qemu-trivial@nongnu.org, peter.maydell@linaro.org, qemu-devel@nongnu.org Subject: Re: [Qemu-trivial] [PATCH for-1.4 v2 4/6] qemu-option: Disable two helpful messages that got broken recently X-BeenThere: qemu-trivial@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Feb 2013 19:34:30 -0000 Luiz Capitulino writes: > On Fri, 08 Feb 2013 19:58:42 +0100 > Markus Armbruster wrote: > >> Luiz Capitulino writes: >> >> > On Fri, 8 Feb 2013 17:17:10 +0100 >> > Markus Armbruster wrote: >> > >> >> commit 8be7e7e4 and commit ec7b2ccb messed up the ordering of error >> >> message and the helpful explanation that should follow it, like this: >> >> >> >> $ qemu-system-x86_64 --nodefaults -S --vnc :0 --chardev null,id=, >> >> Identifiers consist of letters, digits, '-', '.', '_', starting >> >> with a letter. >> >> qemu-system-x86_64: -chardev null,id=,: Parameter 'id' expects >> >> an identifier >> >> >> >> $ qemu-system-x86_64 --nodefaults -S --vnc :0 --machine >> >> kvm_shadow_mem=dunno >> >> You may use k, M, G or T suffixes for kilobytes, megabytes, >> >> gigabytes and terabytes. >> >> qemu-system-x86_64: -machine kvm_shadow_mem=dunno: Parameter >> >> kvm_shadow_mem' expects a size >> >> >> >> Pity. Disable them for now. >> > >> > Oops, sorry. I think I'd prefer to drop them, but as this fixes the problem: >> > >> > Reviewed-by: Luiz Capitulino >> > >> > Also, the real problem here is that general functions like >> > parse_option_size() >> > should never assume/try to guess in which context they're running. So, the >> > best solution here is either to have a general enough error message that's >> > not tied to any context, or let up layers (say vl.c) concatenate the >> > context-dependent part of the error message. >> >> I'm open to suggestions on how to better code the pattern "report an >> error (a short string without newlines) together with some explanation >> or hint (possibly longer string, newlines okay). > > The real problem here is that the k, M, G suffixes, for example, are not > good to be reported by QMP. So maybe we should refactor the code in a way > that we separate what's done in QMP from what is done in HMP/command-line. Isn't it separated already? parse_option_size() is used when parsing key=value,... Such strings should not exist in QMP. If they do, it's a design bug.