From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel@nongnu.org,
"Philippe Mathieu-Daudé" <philmd@mailo.com>,
"Pierrick Bouvier" <pierrick.bouvier@oss.qualcomm.com>,
"Peter Xu" <peterx@redhat.com>,
"Hervé Poussineau" <hpoussin@reactos.org>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Akihiko Odaki" <odaki@rsg.ci.i.u-tokyo.ac.jp>,
"Aurelien Jarno" <aurelien@aurel32.net>,
"Fabiano Rosas" <farosas@suse.de>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"BALATON Zoltan" <balaton@eik.bme.hu>,
"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: Re: [RFC 7/7] qom: improve error message for invalid ID values
Date: Wed, 17 Jun 2026 12:22:50 +0100 [thread overview]
Message-ID: <ajKDikXElrr50mWZ@redhat.com> (raw)
In-Reply-To: <87o6h9o350.fsf@pond.sub.org>
On Wed, Jun 17, 2026 at 12:46:51PM +0200, Markus Armbruster wrote:
> Daniel P. Berrangé <berrange@redhat.com> writes:
>
> > Include the actual ID that was validated, since this may not be
> > obvious in all contexts.
> >
> > Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
>
> Reproducer?
>
> I'm asking because:
>
> $ qemu-system-x86_64 -object id=@
> qemu-system-x86_64: -object id=@: Parameter 'id' expects an identifier
> Identifiers consist of letters, digits, '-', '.', '_', starting with a letter.
>
> This is qemu_opts_create().
>
> And:
>
> {"execute":"device_add","arguments":{"driver":"e1000", "id":"@"}}
> {"error": {"class": "GenericError", "desc": "Invalid qdev ID '@'"}}
>
> This is qdev_set_id().
>
> Ah, found it:
>
> $ qemu-system-x86_64 -object '{"id": "@", "qom-type": "iothread"}'
> qemu-system-x86_64: QOM ID value '@' is not valid
> Identifiers consist of letters, digits, '-', '.', '_', starting with a letter.
Actually in this case it wasn't anything user controlled,
I was calling object_new_with_props internally to create
child objects and it tripped over this due to a bug of
my own making. It was just rather confusing as to what I
had done wrong
>
> > ---
> > qom/object.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/qom/object.c b/qom/object.c
> > index 415d5c5291..9cd17e3bcc 100644
> > --- a/qom/object.c
> > +++ b/qom/object.c
> > @@ -774,7 +774,7 @@ object_new_with_props_helper(const char *typename,
> > (id == NULL && parent == NULL));
> >
> > if (id != NULL && !id_wellformed(id)) {
> > - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "id", "an identifier");
> > + error_setg(errp, "QOM ID value '%s' is not valid", id);
> > error_append_hint(errp, "Identifiers consist of letters, digits, "
> > "'-', '.', '_', starting with a letter.\n");
> > return NULL;
>
> Improvement, but what about other places reporting an error when
> id_wellformed() fails?
>
With regards,
Daniel
--
|: https://berrange.com ~~ https://hachyderm.io/@berrange :|
|: https://libvirt.org ~~ https://entangle-photo.org :|
|: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|
next prev parent reply other threads:[~2026-06-17 11:23 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-16 15:55 [RFC 0/7] qom: deprecate embedded objects and instance properties Daniel P. Berrangé
2026-06-16 15:55 ` [RFC 1/7] meson: add --enable-deprecations configure flag Daniel P. Berrangé
2026-06-16 15:55 ` [RFC 2/7] qom: deprecated embedding object structs within other objects Daniel P. Berrangé
2026-06-16 16:15 ` Peter Maydell
2026-06-16 16:43 ` Daniel P. Berrangé
2026-06-16 15:55 ` [RFC 3/7] qom: deprecate use of instance properties Daniel P. Berrangé
2026-06-16 15:55 ` [RFC 4/7] system: add memory_region_new / memory_region_new_io Daniel P. Berrangé
2026-06-17 12:49 ` Paolo Bonzini
2026-06-17 14:10 ` BALATON Zoltan
2026-06-16 15:55 ` [RFC 5/7] system: add qemu_irq_new / qemu_irq_new_child / qemu_irq_new_array Daniel P. Berrangé
2026-06-16 16:22 ` Peter Maydell
2026-06-16 16:36 ` Daniel P. Berrangé
2026-06-17 10:46 ` Mark Cave-Ayland
2026-06-17 10:45 ` Mark Cave-Ayland
2026-06-16 15:55 ` [RFC 6/7] hw/isa: convert PIIX embedded QOM objects to heap allocated Daniel P. Berrangé
2026-06-16 15:55 ` [RFC 7/7] qom: improve error message for invalid ID values Daniel P. Berrangé
2026-06-17 10:46 ` Markus Armbruster
2026-06-17 11:22 ` Daniel P. Berrangé [this message]
2026-06-16 16:12 ` [RFC 0/7] qom: deprecate embedded objects and instance properties Peter Maydell
2026-06-16 16:40 ` Daniel P. Berrangé
2026-06-17 10:53 ` Mark Cave-Ayland
2026-06-17 10:39 ` Mark Cave-Ayland
2026-06-17 11:00 ` Daniel P. Berrangé
2026-06-17 10:31 ` Mark Cave-Ayland
2026-06-17 13:59 ` BALATON Zoltan
2026-06-17 10:59 ` Markus Armbruster
2026-06-17 11:05 ` Daniel P. Berrangé
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=ajKDikXElrr50mWZ@redhat.com \
--to=berrange@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=armbru@redhat.com \
--cc=aurelien@aurel32.net \
--cc=balaton@eik.bme.hu \
--cc=farosas@suse.de \
--cc=hpoussin@reactos.org \
--cc=marcandre.lureau@redhat.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=mst@redhat.com \
--cc=odaki@rsg.ci.i.u-tokyo.ac.jp \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=philmd@mailo.com \
--cc=pierrick.bouvier@oss.qualcomm.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.