All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert (git)" <dgilbert@redhat.com>
To: qemu-devel@nongnu.org, armbru@redhat.com
Subject: [PATCH] keyval: Print types on merge inconsistency
Date: Tue, 13 Sep 2022 11:08:11 +0100	[thread overview]
Message-ID: <20220913100811.99746-1-dgilbert@redhat.com> (raw)

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)));
                 return;
             } else if (qobject_type(ent->value) == QTYPE_QDICT) {
                 /* Merge sub-dictionaries.  */
-- 
2.37.3



             reply	other threads:[~2022-09-13 10:10 UTC|newest]

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

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=20220913100811.99746-1-dgilbert@redhat.com \
    --to=dgilbert@redhat.com \
    --cc=armbru@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.