Eric Blake <[email protected]> writes:
> Reported to me off-list by Laurent Vivier, who found the
> problem while working on https://bugzilla.redhat.com/1433193
> Broken since 2.7, but the fix is a one-liner (pointing out my
> embarrassing mistake of mis-converting a pre-decrement operator);
> as a bug fix, it still qualifies for 2.9 in spite of hard freeze,
> on the other hand, as the regression was not introduced in 2.9,
> I also understand if it is postponed.
>
> Eric Blake (2):
> tests: Expose regression in QemuOpts visitor
> qapi: Fix QemuOpts visitor regression on unvisited input
>
> qapi/opts-visitor.c | 6 +++---
> tests/test-opts-visitor.c | 29 ++++++++++++++++++++++++++---
> 2 files changed, 29 insertions(+), 6 deletions(-)
Regresses
$ qemu-system-x86_64 -object memory-backend-ram,id=mem1,size=4k
qemu-system-x86_64: -object memory-backend-ram,id=mem1,size=4k: Invalid
parameter 'id'
I guess the culprit is commit 3a4641:
pdict = qemu_opts_to_qdict(opts, NULL);
qdict_del(pdict, "qom-type");
qdict_del(pdict, "id");
v = opts_visitor_new(opts);
obj = user_creatable_add_type(type, id, pdict, v, errp);
visit_free(v);
This deletes "qom-type" and "id" from pdict, but not opts. The deletion
makes user_creatable_add_type() skip visiting them as intended, but it
also makes visit_check_struct() fail, because the opts visitor still
expects the two to be visited.