commit:     60aa4721e747935d2f6a37df35a51f996a9b9929
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Wed May 24 20:00:36 2017 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Wed May 24 20:24:21 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=60aa4721

kde-frameworks/kcoreaddons: Add kdirwatch fix

Package-Manager: Portage-2.3.5, Repoman-2.3.1

 .../kcoreaddons-5.34.0-ignore-qrc-paths.patch      | 93 ++++++++++++++++++++++
 .../kcoreaddons/kcoreaddons-5.34.0-r1.ebuild       | 32 ++++++++
 2 files changed, 125 insertions(+)

diff --git 
a/kde-frameworks/kcoreaddons/files/kcoreaddons-5.34.0-ignore-qrc-paths.patch 
b/kde-frameworks/kcoreaddons/files/kcoreaddons-5.34.0-ignore-qrc-paths.patch
new file mode 100644
index 00000000000..5f23f4eb027
--- /dev/null
+++ b/kde-frameworks/kcoreaddons/files/kcoreaddons-5.34.0-ignore-qrc-paths.patch
@@ -0,0 +1,93 @@
+From 792680d43877efbea7c2367bab564e41da98be45 Mon Sep 17 00:00:00 2001
+From: Elvis Angelaccio <[email protected]>
+Date: Mon, 15 May 2017 23:44:04 +0200
+Subject: Do not watch QRC's paths
+
+Watching a QRC path is not supported and results in `"."` being
+watched which can lead to problems.
+
+For example in bug #374075 KIO adds ":/kio5/newfile-templates"
+as path to watch (this is probably another bug in itself).
+If we are already watching "/home/user", this breaks the emission
+of the dirty() signal for every new children of "/home/user" (somehow,
+the relative path is used for them, e.g. "./foo.txt" instead of
+"/home/user/foo.txt"). In particular, in inotifyEventReceived()
+e->m_client is empty and so e->path is not added to
+e->m_pendingFileChanges. This only happens if "/home/user" is also
+the cwd of the process using KDirWatch.
+
+Ignoring QRC paths fixes this issue.
+
+BUG: 374075
+FIXED-IN: 5.35
+
+Test Plan:
+From dolphin, Create New -> Text File in a folder which is also the current 
working
+directory of the dolphin process.
+
+Reviewers: dfaure
+
+Differential Revision: https://phabricator.kde.org/D5877
+---
+ autotests/kdirwatch_unittest.cpp | 24 ++++++++++++++++++++++++
+ src/lib/io/kdirwatch.cpp         |  4 ++++
+ 2 files changed, 28 insertions(+)
+
+diff --git a/autotests/kdirwatch_unittest.cpp 
b/autotests/kdirwatch_unittest.cpp
+index b436eb4..e574b5a 100644
+--- a/autotests/kdirwatch_unittest.cpp
++++ b/autotests/kdirwatch_unittest.cpp
+@@ -112,6 +112,7 @@ private Q_SLOTS: // test methods
+     void nestedEventLoop();
+     void testHardlinkChange();
+     void stopAndRestart();
++    void shouldIgnoreQrcPaths();
+ 
+ protected Q_SLOTS: // internal slots
+     void nestedEventLoopSlot();
+@@ -749,4 +750,27 @@ void KDirWatch_UnitTest::stopAndRestart()
+     QFile::remove(file3);
+ }
+ 
++void KDirWatch_UnitTest::shouldIgnoreQrcPaths()
++{
++    const auto oldCwd = QDir::currentPath();
++    QVERIFY(QDir::setCurrent(QDir::homePath()));
++
++    KDirWatch watch;
++    watch.addDir(QDir::homePath());
++    // This triggers bug #374075.
++    watch.addDir(QStringLiteral(":/kio5/newfile-templates"));
++
++    QSignalSpy dirtySpy(&watch, &KDirWatch::dirty);
++
++    QFile file(QStringLiteral("bug374075.txt"));
++    QVERIFY(file.open(QIODevice::WriteOnly));
++    QVERIFY(file.write(QByteArrayLiteral("test")));
++    file.close();
++    QVERIFY(file.exists());
++    QVERIFY(dirtySpy.wait());
++    QVERIFY(dirtySpy.count() > 0);
++    QVERIFY(file.remove());
++    QVERIFY(QDir::setCurrent(oldCwd));
++}
++
+ #include "kdirwatch_unittest.moc"
+diff --git a/src/lib/io/kdirwatch.cpp b/src/lib/io/kdirwatch.cpp
+index 060037b..2278b71 100644
+--- a/src/lib/io/kdirwatch.cpp
++++ b/src/lib/io/kdirwatch.cpp
+@@ -791,6 +791,10 @@ void KDirWatchPrivate::addEntry(KDirWatch *instance, 
const QString &_path,
+                                 Entry *sub_entry, bool isDir, 
KDirWatch::WatchModes watchModes)
+ {
+     QString path(_path);
++    if (path.startsWith(QLatin1String(":/"))) {
++        qCWarning(KDIRWATCH) << "Cannot watch QRC-like path" << path;
++        return;
++    }
+     if (path.isEmpty()
+ #ifndef Q_OS_WIN
+             || path == QLatin1String("/dev")
+-- 
+cgit v0.11.2
+

diff --git a/kde-frameworks/kcoreaddons/kcoreaddons-5.34.0-r1.ebuild 
b/kde-frameworks/kcoreaddons/kcoreaddons-5.34.0-r1.ebuild
new file mode 100644
index 00000000000..cf10cf9decb
--- /dev/null
+++ b/kde-frameworks/kcoreaddons/kcoreaddons-5.34.0-r1.ebuild
@@ -0,0 +1,32 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit kde5
+
+DESCRIPTION="Framework for solving common problems such as caching, 
randomisation, and more"
+LICENSE="LGPL-2+"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE="fam nls"
+
+RDEPEND="
+       $(add_qt_dep qtcore 'icu')
+       fam? ( virtual/fam )
+       !<kde-frameworks/kservice-5.2.0:5
+"
+DEPEND="${RDEPEND}
+       x11-misc/shared-mime-info
+       nls? ( $(add_qt_dep linguist-tools) )
+"
+
+PATCHES=( "${FILESDIR}/${P}-ignore-qrc-paths.patch" )
+
+src_configure() {
+       local mycmakeargs=(
+               -D_KDE4_DEFAULT_HOME_POSTFIX=4
+               $(cmake-utils_use_find_package fam FAM)
+       )
+
+       kde5_src_configure
+}

Reply via email to