From: Markus Armbruster <armbru@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: qemu-devel@nongnu.org, "Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2] qapi: Fix error handling code on alternate conflict
Date: Wed, 19 Jul 2017 10:32:45 +0200 [thread overview]
Message-ID: <87vamoyggi.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <20170717180926.14924-1-ehabkost@redhat.com> (Eduardo Habkost's message of "Mon, 17 Jul 2017 15:09:26 -0300")
Eduardo Habkost <ehabkost@redhat.com> writes:
> 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'].
Good catch.
> 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>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
next prev parent reply other threads:[~2017-07-19 8:32 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
2017-07-19 8:32 ` Markus Armbruster [this message]
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=87vamoyggi.fsf@dusky.pond.sub.org \
--to=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 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.