After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 622590 - dict ordering must match for g_variant_equal()
dict ordering must match for g_variant_equal()
Status: RESOLVED OBSOLETE
Product: glib
Classification: Platform
Component: gvariant
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Allison Karlitskaya (desrt)
gtkdev
Depends on:
Blocks:
 
 
Reported: 2010-06-24 12:09 UTC by Danielle Madeley
Modified: 2018-05-24 12:23 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
first pass at a patch (2.43 KB, patch)
2010-06-25 02:06 UTC, Danielle Madeley
none Details | Review
Alternative implementation for a g_variant_equivalent (2.43 KB, text/plain)
2010-06-25 04:15 UTC, Danielle Madeley
  Details

Description Danielle Madeley 2010-06-24 12:09:48 UTC
The ordering of two dictionaries (e.g. a{os}) must be identical for g_variant_equal() to return TRUE.
Comment 1 Danielle Madeley 2010-06-25 02:06:05 UTC
Created attachment 164574 [details] [review]
first pass at a patch

This is a first pass at a patch to make dict ordering unimportant. It has the limitation where it currently only works for a{?*} and not dictionaries inside other containers, e.g. aa{?*}. The way to resolve this would be to make g_variant_equal recurse for container types, but this will make g_variant_equal slower.

Since the primary use for g_variant_equal() seems to be its use in hash tables, and you already can't hash a non-simple key, perhaps the correct solution is to add a more semantically correct version of g_variant_equal() for use in other places.
Comment 2 Danielle Madeley 2010-06-25 04:15:45 UTC
Created attachment 164579 [details]
Alternative implementation for a g_variant_equivalent

Here is an implementation of a g_variant_equivalent that I wrote for my test cases.
Comment 3 Allison Karlitskaya (desrt) 2010-06-25 12:06:18 UTC
We chatted on IRC last night -- there is no chance that either of these pieces of code will make it into glib itself.

What we need instead is a comprehensive review of what a dictionary means in GVariant.

I'm leaving this bug open pending that review and so that people are more likely to find the code in comment 2, if they need it.
Comment 4 Aaron Bockover 2010-06-26 01:09:52 UTC
If a dictionary in GVariant doesn't act like a dictionary in any other implementation, I would consider renaming it in GVariant to avoid any confusion.
Comment 5 Allison Karlitskaya (desrt) 2010-06-26 14:36:58 UTC
dictionaries in GVariant behave exactly as they do in DBus.
Comment 6 GNOME Infrastructure Team 2018-05-24 12:23:48 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glib/issues/314.