All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrange" <berrange@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: "Wei, Jiangang" <weijg.fnst@cn.fujitsu.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] RFC: do we need ordered dict?
Date: Tue, 31 May 2016 10:28:12 +0100	[thread overview]
Message-ID: <20160531092812.GL21628@redhat.com> (raw)
In-Reply-To: <574321D3.1000808@redhat.com>

On Mon, May 23, 2016 at 09:29:23AM -0600, Eric Blake wrote:
> On 05/23/2016 04:14 AM, Wei, Jiangang wrote:
> > Hi all,
> > 
> > I found a problem about the output of 'query-version'
> > 
> 
> > Actually, It's as following,
> > -> { "execute": "query-version" }
> > <- {
> >       "return":{
> >          "qemu":{
> >             "micro":50,
> >             "minor":6,
> >             "major":2
> >          },
> >          "package":""
> >       }
> >    }
> > 
> 
> JSON has no inherent ordering of keys in a dictionary, so I see nothing
> that needs to be changed here.
> 
> > The reason is that the member ''qemu" is regarded as Un-ordered dict.
> > and  tdb_hash() returns the same bucket(225) for both  "micro" and
> > "minor". 
> > and The "major" is bigger (481).
> > 
> > All of the above metioned introduces the disorder for major , minor and
> > micro.
> 
> And if we pick any different hash, the results might be in a different
> order again. But it doesn't make it any less correct, so I don't think
> an ordered dict will help anything, and would instead just cost more
> overhead to write and maintain.

If anything we should be using a hash algorithm that results in a
different hash on every invocation of QEMU, to protect against
malicious users feeding QEMU data which causes pathelogical hash
collisions...


Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

      reply	other threads:[~2016-05-31  9:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-23 10:14 [Qemu-devel] RFC: do we need ordered dict? Wei, Jiangang
2016-05-23 15:29 ` Eric Blake
2016-05-31  9:28   ` Daniel P. Berrange [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=20160531092812.GL21628@redhat.com \
    --to=berrange@redhat.com \
    --cc=eblake@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=weijg.fnst@cn.fujitsu.com \
    /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.