From 03f35e96de2a33fc1756d4404a42b51464d3f953 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 25 Nov 2016 14:11:00 +0100 Subject: [PATCH] config: fix config merging default value for main.plugins Since commit fb2ca0ce3d we would no longer pre-set the main.plugins value in NMConfig's keyfile to recognize unset default settings. This breaks with [main] plugins+=foo which now results in main.plgin=foo while previously it would have extended the compile time default. https://bugzilla.redhat.com/show_bug.cgi?id=1397938 Fixes: fb2ca0ce3dadae8154d2ad8b611538323be137ac --- src/nm-config.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/nm-config.c b/src/nm-config.c index 1095b901f3..03aa6d4b64 100644 --- a/src/nm-config.c +++ b/src/nm-config.c @@ -755,6 +755,13 @@ read_config (GKeyFile *keyfile, gboolean is_base_config, const char *dirname, co if (is_string_list) { old_val = g_key_file_get_string_list (keyfile, group, base_key, NULL, NULL); new_val = g_key_file_get_string_list (kf, group, key, NULL, NULL); + if (!old_val && !g_key_file_has_key (keyfile, group, base_key, NULL)) { + /* we must fill the unspecified value with the compile-time default. */ + if (nm_streq (group, NM_CONFIG_KEYFILE_GROUP_MAIN) && nm_streq (base_key, "plugins")) { + g_key_file_set_value (keyfile, group, base_key, NM_CONFIG_PLUGINS_DEFAULT); + old_val = g_key_file_get_string_list (keyfile, group, base_key, NULL, NULL); + } + } } else { gs_free char *old_sval = nm_config_keyfile_get_value (keyfile, group, base_key, NM_CONFIG_GET_VALUE_TYPE_SPEC); gs_free char *new_sval = nm_config_keyfile_get_value (kf, group, key, NM_CONFIG_GET_VALUE_TYPE_SPEC);