libnm: fix _nm_setting_property_compare_fcn_default() to use nm_g_variant_equal()

nm_property_compare() makes a misguided attempt to compare dictionaries
regardless of their order.

However, if variants contain duplicate keys, then the implementation
is wrong and cannot handle it correctly.

Regardless of that. While in some sense the order of dictionary keys is
irrelevant, this is not the right place to perform such normalization.
If the order of things doesn't matter, then NMSetting must normalize the
property (e.g. by sorting the keys). At that point, the GVariant shall
be compared fully.
This commit is contained in:
Thomas Haller 2023-12-12 14:11:56 +01:00
parent 0e893593a9
commit e415e4fc18
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -11,7 +11,6 @@
#include "libnm-core-intern/nm-core-internal.h"
#include "libnm-glib-aux/nm-ref-string.h"
#include "libnm-glib-aux/nm-secret-utils.h"
#include "nm-property-compare.h"
#include "nm-setting-private.h"
#include "nm-utils-private.h"
#include "nm-utils.h"
@ -2653,7 +2652,7 @@ _nm_setting_property_compare_fcn_default(_NM_SETT_INFO_PROP_COMPARE_FCN_ARGS _nm
NM_CONNECTION_SERIALIZE_ALL,
NULL,
TRUE);
return nm_property_compare(value1, value2) == 0;
return nm_g_variant_equal(value1, value2);
}
}