qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] monitor: HMP: fix consecutive integer expressio


From: Anthony Liguori
Subject: Re: [Qemu-devel] [PATCH] monitor: HMP: fix consecutive integer expression parsing
Date: Fri, 05 Aug 2011 11:51:02 -0500
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110516 Lightning/1.0b2 Thunderbird/3.1.10

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<protocol>  <hostname>  <port>  <tls-port>
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.

Does anyone strongly object?

Regards,

Anthony Liguori



reply via email to

[Prev in Thread] Current Thread [Next in Thread]