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.

> ---
>  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?


Reply via email to