mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-09-06 17:14:02 +00:00
![]() "nm-property-compare.c" only contains nm_property_compare(), which is broken. It tries to compare string dictionaries as equal regardless of the order of elements. It gets it wrong, for dictionaries with duplicate keys. Which means, it can only be used with trusted variants that are known to not contain duplicates. Which is quite a non-starter. Also, the idea of a compare function for GVariant that ignores the order of dictionary elements seems wrong. Even if for a certain application the order does not matter, it still depends what the upper layer makes of duplicate keys (will they bail out, or take the first/last occurrence of a duplicate key?). nm_property_compare() doesn't have the knowledge how upper layer handles it, and it's not obvious what's the right choice. For example, if you use g_variant_lookup(), the first occurrence is preferred. If you iterate over the children, possibly later occurrences overwrite earlier ones. It's ill defined, and maybe shouldn't be done. What should instead happen, is that upper layers normalize (sort, uniquify) the keys, so that we can do a full comparison. For that we have nm_g_variant_cmp(). Drop the now unused code. The core of the function still exists as nm_g_variant_cmp(). |
||
---|---|---|
.. | ||
api | ||
internal | ||
libnm | ||
meson.build | ||
sandboxing.md |