From: Eric Blake <eblake@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>, qemu-devel@nongnu.org
Cc: "Markus Armbruster" <armbru@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2] qapi: Fix error handling code on alternate conflict
Date: Mon, 17 Jul 2017 13:14:37 -0500 [thread overview]
Message-ID: <22df757f-6c8c-9ea9-ef3f-e60a301c6ff5@redhat.com> (raw)
In-Reply-To: <20170717180926.14924-1-ehabkost@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1883 bytes --]
On 07/17/2017 01:09 PM, Eduardo Habkost wrote:
> The conflict check added by commit c0644771 ("qapi: Reject
> alternates that can't work with keyval_parse()") doesn't work
> with the following declaration:
>
> { 'alternate': 'Alt',
> 'data': { 'one': 'bool',
> 'two': 'str' } }
>
> It crashes with:
>
> Traceback (most recent call last):
> File "./scripts/qapi-types.py", line 295, in <module>
> schema = QAPISchema(input_file)
> File "/home/ehabkost/rh/proj/virt/qemu/scripts/qapi.py", line 1468, in __init__
> self.exprs = check_exprs(parser.exprs)
> File "/home/ehabkost/rh/proj/virt/qemu/scripts/qapi.py", line 958, in check_exprs
> check_alternate(expr, info)
> File "/home/ehabkost/rh/proj/virt/qemu/scripts/qapi.py", line 830, in check_alternate
> % (name, key, types_seen[qtype]))
> KeyError: 'QTYPE_QSTRING'
>
> This happens because the previously-seen conflicting member
> ('one') can't be found at types_seen[qtype], but at
> types_seen['QTYPE_BOOL'].
>
> Fix the bug by moving the error check to the same loop that adds
> new items to types_seen, raising an exception if types_seen[qt]
> is already set.
>
> Add two additional test cases that can detect the bug.
>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
If this misses tomorrow's freeze deadline, it's borderline for inclusion
in 2.10 (it does not change the qemu binary proper, but rather fixes a
build tool crash, where the crash is only provoked by bad input and we
won't have any bad input at the time of the freeze) - I'll leave it up
to Markus on whether to take now or defer to 2.11. But either way:
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 619 bytes --]
next prev parent reply other threads:[~2017-07-17 18:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-17 18:09 [Qemu-devel] [PATCH v2] qapi: Fix error handling code on alternate conflict Eduardo Habkost
2017-07-17 18:14 ` Eric Blake [this message]
2017-07-19 8:32 ` Markus Armbruster
2017-07-20 16:14 ` Markus Armbruster
2017-07-20 17:52 ` Eduardo Habkost
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=22df757f-6c8c-9ea9-ef3f-e60a301c6ff5@redhat.com \
--to=eblake@redhat.com \
--cc=armbru@redhat.com \
--cc=ehabkost@redhat.com \
--cc=marcandre.lureau@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).