diff options
author | David Faure <faure@kde.org> | 2018-08-19 12:32:11 +0200 |
---|---|---|
committer | David Faure <faure@kde.org> | 2019-02-04 13:42:18 +0100 |
commit | c6bb7aea21320b9f3cd0e0127aee3aef6db7ccb4 (patch) | |
tree | 828c33cc37810f663b8ed329b1b2b175a54c9ed9 /src/core/kconfigini.cpp | |
parent | d60c5c516880c3859a0f5d3cca46a3b0ba77fa1d (diff) | |
download | kconfig-c6bb7aea21320b9f3cd0e0127aee3aef6db7ccb4.tar.gz kconfig-c6bb7aea21320b9f3cd0e0127aee3aef6db7ccb4.tar.bz2 |
KConfig: handle directory symlinks correctly.
Summary:
When /home is a symlink, for instance (as is often the case on FreeBSD),
group deletion would fail because KConfig was comparing non-canonical
paths with canonical-paths:
QDEBUG : KConfigTest::testDelete() Comparing "/home/adridg/.qttest/config/
kconfigtest_subdir/kconfigtest" and "/usr/home/adridg/.qttest/config/
kconfigtest_subdir/kconfigtest"
Test Plan:
mkdir /tmp/derp; ln -s /tmp/derp /tmp/drop
HOME=/tmp/derp bin/kconfigtest testDelete # Success
HOME=/tmp/drop bin/kconfigtest testDelete # Fail
Reviewers: adridg, arichardson, apol
Reviewed By: apol
Subscribers: kde-frameworks-devel
Tags: #frameworks
Differential Revision: https://phabricator.kde.org/D14927
Diffstat (limited to 'src/core/kconfigini.cpp')
-rw-r--r-- | src/core/kconfigini.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/core/kconfigini.cpp b/src/core/kconfigini.cpp index b6749731..84d77b48 100644 --- a/src/core/kconfigini.cpp +++ b/src/core/kconfigini.cpp @@ -602,7 +602,11 @@ void KConfigIniBackend::setFilePath(const QString &file) if (info.exists()) { setLocalFilePath(info.canonicalFilePath()); } else { - setLocalFilePath(file); + const QString dir = info.dir().canonicalPath(); + if (!dir.isEmpty()) + setLocalFilePath(dir + QLatin1Char('/') + info.fileName()); + else + setLocalFilePath(file); } } |