qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [qemu/qemu] b32abb: qapi: Fix crash on redefinition with


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] b32abb: qapi: Fix crash on redefinition with a different c...
Date: Thu, 26 Aug 2021 07:44:35 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: b32abbb2f563ca26c0f87e848d46e1001568b7f6
      
https://github.com/qemu/qemu/commit/b32abbb2f563ca26c0f87e848d46e1001568b7f6
  Author: Markus Armbruster <armbru@redhat.com>
  Date:   2021-08-26 (Thu, 26 Aug 2021)

  Changed paths:
    M scripts/qapi/schema.py
    M tests/qapi-schema/redefined-event.json

  Log Message:
  -----------
  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>


  Commit: 3248c1aaf2dba296db98813303ccdda822708932
      
https://github.com/qemu/qemu/commit/3248c1aaf2dba296db98813303ccdda822708932
  Author: Marc-André Lureau <marcandre.lureau@redhat.com>
  Date:   2021-08-26 (Thu, 26 Aug 2021)

  Changed paths:
    M docs/devel/qapi-code-gen.rst

  Log Message:
  -----------
  docs: update the documentation upfront about schema configuration

Update the documentation describing the changes in this series.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Tested-by: John Snow <jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210804083105.97531-2-marcandre.lureau@redhat.com>
[Rebased with straightforward conflicts]
Signed-off-by: Markus Armbruster <armbru@redhat.com>


  Commit: f17539c80da3c0ebabbe75a04f5451995367ec91
      
https://github.com/qemu/qemu/commit/f17539c80da3c0ebabbe75a04f5451995367ec91
  Author: Marc-André Lureau <marcandre.lureau@redhat.com>
  Date:   2021-08-26 (Thu, 26 Aug 2021)

  Changed paths:
    M docs/sphinx/qapidoc.py
    M scripts/qapi/commands.py
    M scripts/qapi/events.py
    M scripts/qapi/gen.py
    M scripts/qapi/introspect.py
    M scripts/qapi/schema.py
    M scripts/qapi/types.py
    M scripts/qapi/visit.py
    M tests/qapi-schema/test-qapi.py

  Log Message:
  -----------
  qapi: wrap Sequence[str] in an object

Mechanical change, except for a new assertion in
QAPISchemaEntity.ifcond().

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20210804083105.97531-3-marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Rebased with obvious conflicts, commit message adjusted]
Signed-off-by: Markus Armbruster <armbru@redhat.com>


  Commit: 33aa3267bacc5a7af363c0ffa5f1bdabba54b989
      
https://github.com/qemu/qemu/commit/33aa3267bacc5a7af363c0ffa5f1bdabba54b989
  Author: Marc-André Lureau <marcandre.lureau@redhat.com>
  Date:   2021-08-26 (Thu, 26 Aug 2021)

  Changed paths:
    M docs/sphinx/qapidoc.py
    M scripts/qapi/introspect.py
    M scripts/qapi/schema.py
    M tests/qapi-schema/test-qapi.py

  Log Message:
  -----------
  qapi: add QAPISchemaIfCond.is_present()

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210804083105.97531-4-marcandre.lureau@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>


  Commit: 6cc2e4817ff5b33d6f67e0a5f27dbd1112d1ecd5
      
https://github.com/qemu/qemu/commit/6cc2e4817ff5b33d6f67e0a5f27dbd1112d1ecd5
  Author: Marc-André Lureau <marcandre.lureau@redhat.com>
  Date:   2021-08-26 (Thu, 26 Aug 2021)

  Changed paths:
    M scripts/qapi/common.py
    M scripts/qapi/gen.py
    M scripts/qapi/introspect.py
    M scripts/qapi/schema.py
    M scripts/qapi/types.py
    M scripts/qapi/visit.py

  Log Message:
  -----------
  qapi: introduce QAPISchemaIfCond.cgen()

Instead of building prepocessor conditions from a list of string, use
the result generated from QAPISchemaIfCond.cgen() and hide the
implementation details.

Note: this patch introduces a minor regression, generating a redundant
pair of parenthesis. This is mostly fixed in a later patch in this
series ("qapi: replace if condition list with dict [..]")

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20210804083105.97531-5-marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Commit message tweaked]
Signed-off-by: Markus Armbruster <armbru@redhat.com>


  Commit: d806f89f87152def5f422e946c84948831615236
      
https://github.com/qemu/qemu/commit/d806f89f87152def5f422e946c84948831615236
  Author: Marc-André Lureau <marcandre.lureau@redhat.com>
  Date:   2021-08-26 (Thu, 26 Aug 2021)

  Changed paths:
    M docs/sphinx/qapidoc.py
    M scripts/qapi/common.py
    M scripts/qapi/schema.py

  Log Message:
  -----------
  qapidoc: introduce QAPISchemaIfCond.docgen()

Instead of building the condition documentation from a list of string,
use the result generated from QAPISchemaIfCond.docgen().

This changes the generated documentation from:
- COND1, COND2... (where COND1, COND2 are Literal nodes, and ',' is Text)
to:
- COND1 and COND2 (the whole string as a Literal node)

This will allow us to generate more complex conditions in the following
patches, such as "(COND1 and COND2) or COND3".

Adding back the differentiated formatting is left to the wish list.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20210804083105.97531-6-marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[TODO comment added]
Signed-off-by: Markus Armbruster <armbru@redhat.com>


  Commit: 5d83b9a130690f879d5f33e991beabe69cb88bc8
      
https://github.com/qemu/qemu/commit/5d83b9a130690f879d5f33e991beabe69cb88bc8
  Author: Marc-André Lureau <marcandre.lureau@redhat.com>
  Date:   2021-08-26 (Thu, 26 Aug 2021)

  Changed paths:
    M qapi/ui.json
    M scripts/qapi/common.py
    M scripts/qapi/expr.py
    M scripts/qapi/schema.py
    A tests/qapi-schema/bad-if-all.err
    A tests/qapi-schema/bad-if-all.json
    A tests/qapi-schema/bad-if-all.out
    M tests/qapi-schema/bad-if-empty-list.json
    A tests/qapi-schema/bad-if-key.err
    A tests/qapi-schema/bad-if-key.json
    A tests/qapi-schema/bad-if-key.out
    A tests/qapi-schema/bad-if-keys.err
    A tests/qapi-schema/bad-if-keys.json
    A tests/qapi-schema/bad-if-keys.out
    M tests/qapi-schema/bad-if-list.json
    M tests/qapi-schema/bad-if.err
    M tests/qapi-schema/bad-if.json
    M tests/qapi-schema/doc-good.json
    M tests/qapi-schema/doc-good.out
    M tests/qapi-schema/doc-good.txt
    M tests/qapi-schema/enum-if-invalid.err
    M tests/qapi-schema/features-if-invalid.err
    M tests/qapi-schema/meson.build
    M tests/qapi-schema/qapi-schema-test.json
    M tests/qapi-schema/qapi-schema-test.out
    M tests/qapi-schema/struct-member-if-invalid.err
    M tests/qapi-schema/union-branch-if-invalid.json

  Log Message:
  -----------
  qapi: replace if condition list with dict {'all': [...]}

Replace the simple list sugar form with a recursive structure that will
accept other operators in the following commits (all, any or not).

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20210804083105.97531-7-marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Accidental code motion undone.  Degenerate :forms: comment dropped.
Helper _check_if() moved.  Error messages tweaked.  ui.json updated.
Accidental changes to qapi-schema-test.json dropped.]
Signed-off-by: Markus Armbruster <armbru@redhat.com>


  Commit: 3ad64edfad2fa404e866c01f6d427ed4fe4f4f0f
      
https://github.com/qemu/qemu/commit/3ad64edfad2fa404e866c01f6d427ed4fe4f4f0f
  Author: Marc-André Lureau <marcandre.lureau@redhat.com>
  Date:   2021-08-26 (Thu, 26 Aug 2021)

  Changed paths:
    M scripts/qapi/common.py
    M scripts/qapi/expr.py
    M tests/qapi-schema/bad-if-key.err
    M tests/qapi-schema/bad-if-keys.err
    M tests/qapi-schema/doc-good.json
    M tests/qapi-schema/doc-good.out
    M tests/qapi-schema/doc-good.txt
    M tests/qapi-schema/enum-if-invalid.err
    M tests/qapi-schema/qapi-schema-test.json
    M tests/qapi-schema/qapi-schema-test.out
    M tests/unit/test-qmp-cmds.c

  Log Message:
  -----------
  qapi: add 'any' condition

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20210804083105.97531-8-marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>


  Commit: 8a156d89d15ec190ff519e7ecaaa0b85e1ff4a7b
      
https://github.com/qemu/qemu/commit/8a156d89d15ec190ff519e7ecaaa0b85e1ff4a7b
  Author: Marc-André Lureau <marcandre.lureau@redhat.com>
  Date:   2021-08-26 (Thu, 26 Aug 2021)

  Changed paths:
    M qapi/machine-target.json
    M qapi/misc-target.json

  Log Message:
  -----------
  qapi: Use 'if': { 'any': ... } where appropriate

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Tested-by: John Snow <jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210804083105.97531-9-marcandre.lureau@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>


  Commit: 2b7d2145369f2ca55ded9045393bb860ee3f6745
      
https://github.com/qemu/qemu/commit/2b7d2145369f2ca55ded9045393bb860ee3f6745
  Author: Marc-André Lureau <marcandre.lureau@redhat.com>
  Date:   2021-08-26 (Thu, 26 Aug 2021)

  Changed paths:
    M scripts/qapi/common.py
    M scripts/qapi/expr.py
    M tests/qapi-schema/bad-if-key.err
    M tests/qapi-schema/bad-if-keys.err
    M tests/qapi-schema/doc-good.json
    M tests/qapi-schema/doc-good.out
    M tests/qapi-schema/doc-good.txt
    M tests/qapi-schema/enum-if-invalid.err
    M tests/qapi-schema/qapi-schema-test.json
    M tests/qapi-schema/qapi-schema-test.out

  Log Message:
  -----------
  qapi: add 'not' condition operation

For the sake of completeness, introduce the 'not' condition.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20210804083105.97531-10-marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Long line broken in tests/qapi-schema/qapi-schema-test.json]
Signed-off-by: Markus Armbruster <armbru@redhat.com>


  Commit: 8a9f1e1d9cc55f5eb0946cbf8fd1ef9a0e7d3dac
      
https://github.com/qemu/qemu/commit/8a9f1e1d9cc55f5eb0946cbf8fd1ef9a0e7d3dac
  Author: Marc-André Lureau <marcandre.lureau@redhat.com>
  Date:   2021-08-26 (Thu, 26 Aug 2021)

  Changed paths:
    M qapi/block-core.json
    M qapi/block-export.json
    M qapi/char.json
    M qapi/machine-target.json
    M qapi/migration.json
    M qapi/misc-target.json
    M qapi/qom.json
    M qapi/sockets.json
    M qapi/tpm.json
    M qapi/ui.json
    M qga/qapi-schema.json
    M scripts/qapi/common.py
    M scripts/qapi/expr.py
    M tests/qapi-schema/alternate-branch-if-invalid.err
    M tests/qapi-schema/bad-if-empty.err
    M tests/qapi-schema/bad-if-list.err
    M tests/qapi-schema/bad-if.json
    M tests/qapi-schema/doc-good.json
    M tests/qapi-schema/doc-good.out
    M tests/qapi-schema/doc-good.txt
    M tests/qapi-schema/features-missing-name.json
    M tests/qapi-schema/qapi-schema-test.json
    M tests/qapi-schema/qapi-schema-test.out
    M tests/qapi-schema/redefined-event.json
    M tests/qapi-schema/union-branch-if-invalid.err

  Log Message:
  -----------
  qapi: make 'if' condition strings simple identifiers

Change the 'if' condition strings to be C-agnostic. It will accept
'[A-Z][A-Z0-9_]*' identifiers. This allows to express configuration
conditions in other languages (Rust or Python for ex) or other more
suitable forms.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Tested-by: John Snow <jsnow@redhat.com>
Message-Id: <20210804083105.97531-11-marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Rebased with semantic conflict in redefined-event.json]
Signed-off-by: Markus Armbruster <armbru@redhat.com>


  Commit: c83fcfaf8a54d0d034bd0edf7bbb3b0d16669be9
      
https://github.com/qemu/qemu/commit/c83fcfaf8a54d0d034bd0edf7bbb3b0d16669be9
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2021-08-26 (Thu, 26 Aug 2021)

  Changed paths:
    M docs/devel/qapi-code-gen.rst
    M docs/sphinx/qapidoc.py
    M qapi/block-core.json
    M qapi/block-export.json
    M qapi/char.json
    M qapi/machine-target.json
    M qapi/migration.json
    M qapi/misc-target.json
    M qapi/qom.json
    M qapi/sockets.json
    M qapi/tpm.json
    M qapi/ui.json
    M qga/qapi-schema.json
    M scripts/qapi/commands.py
    M scripts/qapi/common.py
    M scripts/qapi/events.py
    M scripts/qapi/expr.py
    M scripts/qapi/gen.py
    M scripts/qapi/introspect.py
    M scripts/qapi/schema.py
    M scripts/qapi/types.py
    M scripts/qapi/visit.py
    M tests/qapi-schema/alternate-branch-if-invalid.err
    A tests/qapi-schema/bad-if-all.err
    A tests/qapi-schema/bad-if-all.json
    A tests/qapi-schema/bad-if-all.out
    M tests/qapi-schema/bad-if-empty-list.json
    M tests/qapi-schema/bad-if-empty.err
    A tests/qapi-schema/bad-if-key.err
    A tests/qapi-schema/bad-if-key.json
    A tests/qapi-schema/bad-if-key.out
    A tests/qapi-schema/bad-if-keys.err
    A tests/qapi-schema/bad-if-keys.json
    A tests/qapi-schema/bad-if-keys.out
    M tests/qapi-schema/bad-if-list.err
    M tests/qapi-schema/bad-if-list.json
    M tests/qapi-schema/bad-if.err
    M tests/qapi-schema/bad-if.json
    M tests/qapi-schema/doc-good.json
    M tests/qapi-schema/doc-good.out
    M tests/qapi-schema/doc-good.txt
    M tests/qapi-schema/enum-if-invalid.err
    M tests/qapi-schema/features-if-invalid.err
    M tests/qapi-schema/features-missing-name.json
    M tests/qapi-schema/meson.build
    M tests/qapi-schema/qapi-schema-test.json
    M tests/qapi-schema/qapi-schema-test.out
    M tests/qapi-schema/redefined-event.json
    M tests/qapi-schema/struct-member-if-invalid.err
    M tests/qapi-schema/test-qapi.py
    M tests/qapi-schema/union-branch-if-invalid.err
    M tests/qapi-schema/union-branch-if-invalid.json
    M tests/unit/test-qmp-cmds.c

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2021-08-26' into 
staging

QAPI patches patches for 2021-08-26

# gpg: Signature made Thu 26 Aug 2021 13:18:34 BST
# gpg:                using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653
# gpg:                issuer "armbru@redhat.com"
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full]
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>" [full]
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653

* remotes/armbru/tags/pull-qapi-2021-08-26:
  qapi: make 'if' condition strings simple identifiers
  qapi: add 'not' condition operation
  qapi: Use 'if': { 'any': ... } where appropriate
  qapi: add 'any' condition
  qapi: replace if condition list with dict {'all': [...]}
  qapidoc: introduce QAPISchemaIfCond.docgen()
  qapi: introduce QAPISchemaIfCond.cgen()
  qapi: add QAPISchemaIfCond.is_present()
  qapi: wrap Sequence[str] in an object
  docs: update the documentation upfront about schema configuration
  qapi: Fix crash on redefinition with a different condition

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


Compare: https://github.com/qemu/qemu/compare/0a9be955459f...c83fcfaf8a54



reply via email to

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