From: Anthony Liguori <anthony@codemonkey.ws>
To: Blue Swirl <blauwirbel@gmail.com>
Cc: Alon Levy <alevy@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] monitor: HMP: fix consecutive integer expression parsing
Date: Fri, 05 Aug 2011 16:08:50 -0500 [thread overview]
Message-ID: <4E3C5BE2.8030500@codemonkey.ws> (raw)
In-Reply-To: <CAAu8pHsE2gAq0BAXkEbQ5jtAcMRo6=0rWXU4KLjUS9hxK=d2Ug@mail.gmail.com>
On 08/05/2011 03:39 PM, Blue Swirl wrote:
> On Fri, Aug 5, 2011 at 4:51 PM, Anthony Liguori<anthony@codemonkey.ws> wrote:
>> 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?
>
> I think the expressions would be useful with memory addresses, like
> "xp/i $pc-4", but I usually start GDB in these cases. Can we disable
> the expressions only for ports?
Not sure what you mean by ports. You mean for anything but vc? My goal
in disabling the expressions would be to simplify the parsing by
removing all that messy code.
Regards,
Anthony Liguori
>
next prev parent reply other threads:[~2011-08-05 21:08 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-03 11:57 [Qemu-devel] [PATCH] monitor: HMP: fix consecutive integer expression parsing Alon Levy
2011-08-03 13:48 ` Alon Levy
2011-08-05 16:51 ` Anthony Liguori
2011-08-05 17:19 ` Markus Armbruster
2011-08-05 20:39 ` Blue Swirl
2011-08-05 21:08 ` Anthony Liguori [this message]
2011-08-05 21:23 ` Blue Swirl
2011-08-08 6:21 ` Markus Armbruster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4E3C5BE2.8030500@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=alevy@redhat.com \
--cc=blauwirbel@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.