Received: from eggs.gnu.org ([140.186.70.92]:59255) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QpO3j-0006Et-Qk for qemu-devel@nongnu.org; Fri, 05 Aug 2011 13:19:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QpO3i-0001PR-Lg for qemu-devel@nongnu.org; Fri, 05 Aug 2011 13:19:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47054) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QpO3i-0001PF-EX for qemu-devel@nongnu.org; Fri, 05 Aug 2011 13:19:42 -0400 From: Markus Armbruster References: <1312372647-6329-1-git-send-email-alevy@redhat.com> <4E3C1F76.30107@codemonkey.ws> Date: Fri, 05 Aug 2011 19:19:37 +0200 In-Reply-To: <4E3C1F76.30107@codemonkey.ws> (Anthony Liguori's message of "Fri, 05 Aug 2011 11:51:02 -0500") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [Qemu-devel] [PATCH] monitor: HMP: fix consecutive integer expression parsing List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Alon Levy , qemu-devel@nongnu.org Anthony Liguori writes: > On 08/03/2011 06:57 AM, Alon Levy wrote: >> Currently a command that takes two consecutive integer operations, like >> client_migrate_info, will be incorrectly parsed by the human monitor if >> the second expression begins with a minus ('-') or plus ('+') sign: >> >> client_migrate_info >> client_migrate_info spice localhost 5900 -1 >> => port = 5899 = 5900 - 1 >> tls-port = -1 >> But expected by the user to be: >> port = 5900 >> tls-port = -1 >> >> The fix is that for any required integer (ilM) expression followed by another >> integer expression (ilM) the first expression will be parsed by expr_unary >> instead of expr_sum. So you can still use arithmetic, but you have to enclose >> it in parenthesis: >> >> Command line | Old parsed result | With patch result >> (1+1) 2 | 2, 2 | 2, 2 >> 1 -1 | 0, -1 | 1, -1 >> The rest are bizarre but not any worse then before >> 1+2+3 | 6, 5 | 1, 5 >> (1+2)+3 | 3, 3 | 3, 3 > > I vote for just removing the expression parsing entirely. It's > incredibly non-intuitive and I don't think anyone really uses it. Yes, please. > Does anyone strongly object?