From: Markus Armbruster <armbru@redhat.com>
To: John Snow <jsnow@redhat.com>
Cc: qemu-devel@nongnu.org, "Fabiano Rosas" <farosas@suse.de>,
"Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>,
"Philippe Mathieu-Daudé" <philmd@mailo.com>,
"Hanna Reitz" <hreitz@redhat.com>,
qemu-block@nongnu.org, "Zhao Liu" <zhao1.liu@intel.com>,
linux-cxl@vger.kernel.org, "Lukas Straub" <lukasstraub2@web.de>,
"Jonathan Cameron" <jic23@kernel.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Peter Xu" <peterx@redhat.com>,
"Michael Roth" <michael.roth@amd.com>,
"Jason Wang" <jasowangio@gmail.com>,
"Eric Blake" <eblake@redhat.com>, "Kevin Wolf" <kwolf@redhat.com>,
"Junjie Cao" <junjie.cao@intel.com>
Subject: Re: [PATCH v3 5/7] qapi/parser: fix intermediate "intro" detection
Date: Wed, 16 Sep 2026 09:10:04 +0200 [thread overview]
Message-ID: <87bj9xekoj.fsf@pond.sub.org> (raw)
In-Reply-To: <20260915211434.3511110-6-jsnow@redhat.com> (John Snow's message of "Tue, 15 Sep 2026 17:14:32 -0400")
John Snow <jsnow@redhat.com> writes:
> In 43e7ad1a3fa5, I adjusted the insertion algorithm for inserting
> something after the "introduction" to cope with both the old and new
> syntax while we converted QAPI to the new syntax. There's a bug in
> that code that only shows up in a handful of cases and only when using
> the new syntax while this affordance/flex code is still enabled.
>
> In the case that we do actually have a real bona-fide intro section,
> we want to insert directly after that real-deal intro section, not
> after any plaintext sections that may follow it. This code adjusts the
> temporary code to strongly prefer inserting after the actual intro
> section if it exists.
>
> Once again: once conversion is done, you will be delighted by how much
> of this ugly code goes away.
>
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
> scripts/qapi/parser.py | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py
> index 9e14c2f7921..79f03062eea 100644
> --- a/scripts/qapi/parser.py
> +++ b/scripts/qapi/parser.py
> @@ -845,6 +845,13 @@ def _insert_after_intro(
> needed and ``_insert_near_kind(QAPIDoc.Kind.INTRO, ...)`` will
> be sufficient.
> """
> + first = self.all_sections[0]
> + if first.text and first.kind == QAPIDoc.Kind.INTRO:
> + # First section is introduction and is non-empty: insert here.
> + # Rest assured all of this ugliness will very soon go away.
> + # Pinkie-swear.
> + self._insert_near_kind(QAPIDoc.Kind.INTRO, section, after=True)
> +
> index = 0
> for index, ref_section in enumerate(self.all_sections):
> if ref_section.kind.name in ("PLAIN", "INTRO"):
This seems to insert generated sections twice, but only sometimes.
Two examples:
Command query-status (Since: 0.14)
Query the run status of the VM
Return:
"StatusInfo"
+ Return:
+ "StatusInfo"
+
Example::
-> { "execute": "query-status" }
<- { "return": { "running": true,
"status": "running" } }
and
Enum DisplayProtocol (Since: 7.0)
Display protocols which support changing password options.
Values:
* **vnc** -- Not documented
+ * **vnc** -- Not documented
+
* **spice** -- Not documented
next prev parent reply other threads:[~2026-09-16 7:12 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-15 21:14 [PATCH v3 0/7] qapi: convert remaining "simple" intro sections John Snow
2026-09-15 21:14 ` [PATCH v3 1/7] qapi: convert remaining simple intros for block-export.json John Snow
2026-09-15 21:14 ` [PATCH v3 2/7] qapi: convert remaining simple intros for cxl.json John Snow
2026-09-15 21:14 ` [PATCH v3 3/7] qapi: convert remaining simple intros for machine.json John Snow
2026-09-15 21:14 ` [PATCH v3 4/7] qapi: convert remaining simple intros for block-core.json John Snow
2026-09-15 21:14 ` [PATCH v3 5/7] qapi/parser: fix intermediate "intro" detection John Snow
2026-09-16 7:10 ` Markus Armbruster [this message]
2026-09-15 21:14 ` [PATCH v3 6/7] qapi: convert intro sections with "TODO" markers John Snow
2026-09-15 21:14 ` [PATCH v3 7/7] qapi: convert intro sections followed by notes/examples John Snow
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=87bj9xekoj.fsf@pond.sub.org \
--to=armbru@redhat.com \
--cc=eblake@redhat.com \
--cc=farosas@suse.de \
--cc=hreitz@redhat.com \
--cc=jasowangio@gmail.com \
--cc=jic23@kernel.org \
--cc=jsnow@redhat.com \
--cc=junjie.cao@intel.com \
--cc=kwolf@redhat.com \
--cc=linux-cxl@vger.kernel.org \
--cc=lukasstraub2@web.de \
--cc=michael.roth@amd.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=philmd@mailo.com \
--cc=philmd@oss.qualcomm.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=zhao1.liu@intel.com \
/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.