Review Request: Fix KConfigIniBackend::isWritable() when the parent directory doesn't exist

Anssi Hannula anssi at
Fri Dec 30 02:44:54 GMT 2011

This is an automatically generated e-mail. To reply, visit:

Review request for kdelibs.


KConfigIniBackend::isWritable() tries to handle cases where the config
file doesn't exist and one or more of the deepest directories don't
exist either, in which case 'true' is returned if the deepest directory
is writable.

However, this fails because the code tries to use QDir::cdUp() to go
upwards until an existing directory is found. As per documentation,
cdUp() will fail when the parent directory doesn't exist, causing
isWritable() to bail out and return false without checking further
parent directories.

This will cause e.g. KConfig::accessMode() to return ReadOnly if the
configuration directory structure doesn't exist yet, even if the KConfig
is actually writeable (the parent directories are automatically created
by KConfigIniBackend at writing time). This was observed at

Fix that by walking through the tree using QFileInfo::absolutePath()


  kdecore/config/kconfigini.cpp 5f7ba7c 



Built kdelibs 4.7.95 with the patch, the error message in the referenced Mageia bugreport comment (which is shown when accessMode() returns ReadOnly) doesn't show up anymore when the ~/.kde4 directory tree doesn't exist. Also, if I create an empty ~/.kde4 dir without any permissions, the accessMode() call still returns ReadOnly as expected.


Anssi Hannula

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the kde-core-devel mailing list