All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: "Dr. David Alan Gilbert (git)" <dgilbert@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH] keyval: Print types on merge inconsistency
Date: Fri, 16 Sep 2022 07:47:21 +0200	[thread overview]
Message-ID: <87o7vfg9au.fsf@pond.sub.org> (raw)
In-Reply-To: <20220913100811.99746-1-dgilbert@redhat.com> (David Alan Gilbert's message of "Tue, 13 Sep 2022 11:08:11 +0100")

"Dr. David Alan Gilbert (git)" <dgilbert@redhat.com> writes:

> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
>
> When 'keyval_do_merge' checks consistency of types, if they mismatch
> print the types so we get a hint of what's going on.
>
> e.g.
> qemu-system-x86_64: Parameter 'memory' used inconsistently (qstring/qdict)
>
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
>  util/keyval.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/util/keyval.c b/util/keyval.c
> index 66a5b4740f..9757adf31f 100644
> --- a/util/keyval.c
> +++ b/util/keyval.c
> @@ -329,8 +329,10 @@ static void keyval_do_merge(QDict *dest, const QDict *merged, GString *str, Erro
>          old_value = qdict_get(dest, ent->key);
>          if (old_value) {
>              if (qobject_type(old_value) != qobject_type(ent->value)) {
> -                error_setg(errp, "Parameter '%s%s' used inconsistently",
> -                           str->str, ent->key);
> +                error_setg(errp, "Parameter '%s%s' used inconsistently (%s/%s)",
> +                           str->str, ent->key,
> +                           QType_str(qobject_type(old_value)),
> +                           QType_str(qobject_type(ent->value)));

Two more, one in keyval_parse_put(), and one in keyval_listify().

The error message talks in developer terms.  Can we talk in user terms
instead?  Could showing the conflicting key suffice?

>                  return;
>              } else if (qobject_type(ent->value) == QTYPE_QDICT) {
>                  /* Merge sub-dictionaries.  */



      reply	other threads:[~2022-09-16  5:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-13 10:08 [PATCH] keyval: Print types on merge inconsistency Dr. David Alan Gilbert (git)
2022-09-16  5:47 ` Markus Armbruster [this message]

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=87o7vfg9au.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=dgilbert@redhat.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.