strange problem with KConfig

Marco Martin notmart at gmail.com
Thu Feb 5 19:49:16 UTC 2015


Hi all,
I was investigating this bug..
https://bugs.kde.org/show_bug.cgi?id=343583

but after digging and digging, it looks like more and more an issue in 
KConfig..
basically if there is a config file in a system-wide location (to give default 
configs that would then be overridden by whatever other value in ~/.config)

config writing will be wrong. a KConfigGroup::writeEntry will end up writing 
*twice* the key, both with the value specified in the global config file (instead 
of the one passed to writeentry)

As far i understood may be an issue in the kconfig backend that does the actual 
write,
the patch below appears to fix the problem, but i guess is very wrong (it will 
just skip writing any default value)

Do somebody has a smarter idea? :)

Cheers
Marco Martin

diff --git a/src/core/kconfigini.cpp b/src/core/kconfigini.cpp                                   
index 856b7b7..486cfcb 100644
--- a/src/core/kconfigini.cpp
+++ b/src/core/kconfigini.cpp
@@ -319,7 +319,7 @@ void KConfigIniBackend::writeEntries(const QByteArray 
&locale, QIODevice &file,
         }
 
         // the only thing we care about groups is, is it immutable?
-        if (key.mKey.isNull()) {
+        if (key.mKey.isNull() || key.bDefault) {
             groupIsImmutable = it->bImmutable;
             continue; // skip
         }



More information about the Kde-frameworks-devel mailing list