On Wed, Jun 17, 2026 at 12:46:51PM +0200, Markus Armbruster wrote:
> Daniel P. Berrangé <[email protected]> writes:
>
> > Include the actual ID that was validated, since this may not be
> > obvious in all contexts.
> >
> > Signed-off-by: Daniel P. Berrangé <[email protected]>
>
> 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 :|