OSDN Git Service

qapi: Fix crash on redefinition with a different condition
authorMarkus Armbruster <armbru@redhat.com>
Fri, 6 Aug 2021 12:05:10 +0000 (14:05 +0200)
committerMarkus Armbruster <armbru@redhat.com>
Thu, 26 Aug 2021 11:53:56 +0000 (13:53 +0200)
commitb32abbb2f563ca26c0f87e848d46e1001568b7f6
tree0ab9b70d8eb3310fac20d7218ce7072c86e89bbc
parentd8ae530ec00368d4adfb996b5ef6c74cb4460504
qapi: Fix crash on redefinition with a different condition

QAPISchema._make_implicit_object_type() asserts that when an implicit
object type is used multiple times, @ifcond is the same for all uses.
It will be for legitimate uses, i.e. simple union branch wrapper
types.  A comment explains this.

The assertion fails when a command or event is redefined with a
different condition.  The redefinition is an error, but it's flagged
only later.

Fixing the assertion would complicate matters further.  Not
worthwhile, drop it instead.  We really need to get rid of simple
unions.

Tweak test case redefined-event to cover redefinition with a different
condition.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210806120510.2367124-1-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
scripts/qapi/schema.py
tests/qapi-schema/redefined-event.json