From: "Andreas Sturmlechner" <asturm@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: net-p2p/ktorrent/, net-p2p/ktorrent/files/
Date: Sat, 8 Sep 2018 12:09:17 +0000 (UTC) [thread overview]
Message-ID: <1536408228.e1215ae690131a79d311de83a1b26259ed0d09eb.asturm@gentoo> (raw)
commit: e1215ae690131a79d311de83a1b26259ed0d09eb
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 8 11:26:34 2018 +0000
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Sat Sep 8 12:03:48 2018 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e1215ae6
net-p2p/ktorrent: 5.1.1 version bump
Package-Manager: Portage-2.3.49, Repoman-2.3.10
net-p2p/ktorrent/Manifest | 1 +
.../ktorrent-5.1.1-scanfolder-memcorruption.patch | 69 ++++++++++++++
net-p2p/ktorrent/ktorrent-5.1.1.ebuild | 105 +++++++++++++++++++++
3 files changed, 175 insertions(+)
diff --git a/net-p2p/ktorrent/Manifest b/net-p2p/ktorrent/Manifest
index b6dda2840ea..01fb39595d9 100644
--- a/net-p2p/ktorrent/Manifest
+++ b/net-p2p/ktorrent/Manifest
@@ -1 +1,2 @@
DIST ktorrent-5.1.0.tar.xz 2046916 BLAKE2B 865004b84d649774420e2bd0087c416c5de4df40dfe5800ec539049001d93f66925025780987060ad09e1ba2a20045bd6d92c9202c98c28ec68d87758a88af74 SHA512 7bfe3a04a2b0f62d68b41c946af34e9f6ead6aa4ff7818a9c0ce2e83629d311e9e9be5fb1689065ce2601c43bd576b27d8c6946b845d4cdf5fa6362d53e8dd25
+DIST ktorrent-5.1.1.tar.xz 2049392 BLAKE2B 09ad841e1b6d7f332b19e2a660130b1f2b998cd6839614800cde7c99c8ec7f119f2adbdc3d9e06c8525e2dde534d73dab521c7df1d01b2fd0eb6b11fbb868d8f SHA512 bbe744853018380e30efc6ef95916a9b6f0ebec812d70d7970e5e7183d860d147b0693dd0107b146a5987aa27f30cd335fad73c8967839d53eee1c5b63a53c06
diff --git a/net-p2p/ktorrent/files/ktorrent-5.1.1-scanfolder-memcorruption.patch b/net-p2p/ktorrent/files/ktorrent-5.1.1-scanfolder-memcorruption.patch
new file mode 100644
index 00000000000..4c41a6af11d
--- /dev/null
+++ b/net-p2p/ktorrent/files/ktorrent-5.1.1-scanfolder-memcorruption.patch
@@ -0,0 +1,69 @@
+From 2d73d5f25a1a364a2115fb1d3262377f7fdf99cd Mon Sep 17 00:00:00 2001
+From: Valeriy Malov <jazzvoid@gmail.com>
+Date: Wed, 5 Sep 2018 20:43:51 +0300
+Subject: Fix memory corruption in ScanFolder plugin
+
+Summary:
+Reasoning behind this patch is kinda dubious because I don't fully understand what happens, but it shouldn't make the matters worse either
+
+Seems like deletion of KDirWatch objects from scan_folder in ~ScanThread(), after said QThread has been stopped, causes memory corruption.
+
+Preemptively deleting scan_folder contents before we stop the thread resolves this.
+
+also mark booleans shared across main thread and KDirWatch callbacks as atomic
+
+Test Plan:
+Without this patch unloading ScanFolder plugin sometimes crashes ktorrent, including unloading on exit
+Doesn't happen anymore with this patch
+
+Reviewers: stikonas
+
+Reviewed By: stikonas
+
+Differential Revision: https://phabricator.kde.org/D15265
+---
+ plugins/scanfolder/scanthread.cpp | 5 +++++
+ plugins/scanfolder/scanthread.h | 5 +++--
+ 2 files changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/plugins/scanfolder/scanthread.cpp b/plugins/scanfolder/scanthread.cpp
+index 0e62768..d7b13e0 100644
+--- a/plugins/scanfolder/scanthread.cpp
++++ b/plugins/scanfolder/scanthread.cpp
+@@ -156,6 +156,11 @@ namespace kt
+ void ScanThread::stop()
+ {
+ stop_requested = true;
++
++ // XXX seems like deleting KDirWatch object(s) created in scan_folders
++ // in destructor of this QThread after it has been stopped
++ // causes memory corruption, so we delete them early
++ scan_folders.clear();
+ exit();
+ wait();
+ }
+diff --git a/plugins/scanfolder/scanthread.h b/plugins/scanfolder/scanthread.h
+index d13ca08..fb214a4 100644
+--- a/plugins/scanfolder/scanthread.h
++++ b/plugins/scanfolder/scanthread.h
+@@ -29,6 +29,7 @@
+ #include <util/ptrmap.h>
+ #include "scanfolder.h"
+
++#include <atomic>
+
+ class QDir;
+
+@@ -88,8 +89,8 @@ namespace kt
+ private:
+ QMutex mutex;
+ QStringList folders;
+- bool stop_requested;
+- bool recursive;
++ std::atomic<bool> stop_requested;
++ std::atomic<bool> recursive;
+ bt::PtrMap<QString, ScanFolder> scan_folders;
+ };
+
+--
+cgit v0.11.2
diff --git a/net-p2p/ktorrent/ktorrent-5.1.1.ebuild b/net-p2p/ktorrent/ktorrent-5.1.1.ebuild
new file mode 100644
index 00000000000..6283ae3c7ca
--- /dev/null
+++ b/net-p2p/ktorrent/ktorrent-5.1.1.ebuild
@@ -0,0 +1,105 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+FRAMEWORKS_MINIMAL="5.50.0" # for syndication
+KDE_HANDBOOK="forceoptional"
+KDE_TEST="optional"
+VIRTUALX_REQUIRED="test"
+inherit kde5
+
+DESCRIPTION="Powerful BitTorrent client based on KDE Frameworks"
+HOMEPAGE="https://www.kde.org/applications/internet/ktorrent/"
+[[ ${KDE_BUILD_TYPE} = release ]] && SRC_URI="mirror://kde/stable/${PN}/${PV/%.0}/${P}.tar.xz"
+
+LICENSE="GPL-2"
+KEYWORDS="~amd64 ~x86"
+IUSE="+bwscheduler +downloadorder +infowidget +ipfilter +kross +logviewer +magnetgenerator
++mediaplayer rss +scanfolder +search +shutdown +stats +upnp +zeroconf"
+
+COMMON_DEPEND="
+ $(add_frameworks_dep kcmutils)
+ $(add_frameworks_dep kconfig)
+ $(add_frameworks_dep kconfigwidgets)
+ $(add_frameworks_dep kcoreaddons)
+ $(add_frameworks_dep kcrash)
+ $(add_frameworks_dep kdbusaddons)
+ $(add_frameworks_dep ki18n)
+ $(add_frameworks_dep kiconthemes)
+ $(add_frameworks_dep kio)
+ $(add_frameworks_dep knotifications)
+ $(add_frameworks_dep knotifyconfig)
+ $(add_frameworks_dep kparts)
+ $(add_frameworks_dep kwidgetsaddons)
+ $(add_frameworks_dep kwindowsystem)
+ $(add_frameworks_dep kxmlgui)
+ $(add_frameworks_dep solid)
+ $(add_qt_dep qtdbus)
+ $(add_qt_dep qtgui)
+ $(add_qt_dep qtnetwork)
+ $(add_qt_dep qtwidgets)
+ $(add_qt_dep qtxml)
+ =net-libs/libktorrent-2.1*:5
+ infowidget? ( dev-libs/geoip )
+ kross? (
+ $(add_frameworks_dep karchive)
+ $(add_frameworks_dep kitemviews)
+ $(add_frameworks_dep kross)
+ )
+ mediaplayer? (
+ media-libs/phonon[qt5(+)]
+ >=media-libs/taglib-1.5
+ )
+ rss? (
+ $(add_frameworks_dep kdewebkit)
+ $(add_frameworks_dep syndication)
+ )
+ search? (
+ $(add_frameworks_dep kdewebkit)
+ $(add_qt_dep qtwebkit)
+ )
+ shutdown? ( $(add_plasma_dep plasma-workspace) )
+ stats? ( $(add_frameworks_dep kplotting) )
+ upnp? ( $(add_frameworks_dep kcompletion) )
+ zeroconf? ( $(add_frameworks_dep kdnssd) )
+"
+DEPEND="${COMMON_DEPEND}
+ dev-libs/boost
+ sys-devel/gettext
+"
+RDEPEND="${COMMON_DEPEND}
+ ipfilter? (
+ app-arch/bzip2
+ app-arch/unzip
+ $(add_frameworks_dep ktextwidgets)
+ $(add_kdeapps_dep kio-extras)
+ )
+ !net-p2p/ktorrent:4
+"
+
+PATCHES=( "${FILESDIR}/${P}-scanfolder-memcorruption.patch" )
+
+src_configure() {
+ local mycmakeargs=(
+ -DENABLE_BWSCHEDULER_PLUGIN=$(usex bwscheduler)
+ -DENABLE_DOWNLOADORDER_PLUGIN=$(usex downloadorder)
+ -DENABLE_INFOWIDGET_PLUGIN=$(usex infowidget)
+ -DWITH_SYSTEM_GEOIP=$(usex infowidget)
+ -DENABLE_IPFILTER_PLUGIN=$(usex ipfilter)
+ -DENABLE_SCRIPTING_PLUGIN=$(usex kross)
+ -DENABLE_LOGVIEWER_PLUGIN=$(usex logviewer)
+ -DENABLE_MAGNETGENERATOR_PLUGIN=$(usex magnetgenerator)
+ -DENABLE_MEDIAPLAYER_PLUGIN=$(usex mediaplayer)
+ $(cmake-utils_use_find_package rss KF5Syndication)
+ -DENABLE_SCANFOLDER_PLUGIN=$(usex scanfolder)
+ -DENABLE_SEARCH_PLUGIN=$(usex search)
+ -DENABLE_SHUTDOWN_PLUGIN=$(usex shutdown)
+ -DENABLE_STATS_PLUGIN=$(usex stats)
+ -DENABLE_UPNP_PLUGIN=$(usex upnp)
+ -DENABLE_ZEROCONF_PLUGIN=$(usex zeroconf)
+ )
+# add back when ported
+# -DENABLE_WEBINTERFACE_PLUGIN=$(usex webinterface)
+ kde5_src_configure
+}
next reply other threads:[~2018-09-08 12:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-08 12:09 Andreas Sturmlechner [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-04-06 8:23 [gentoo-commits] repo/gentoo:master commit in: net-p2p/ktorrent/, net-p2p/ktorrent/files/ Andreas Sturmlechner
2020-07-20 21:34 Andreas Sturmlechner
2020-07-11 1:25 Andreas Sturmlechner
2020-01-04 13:55 Andreas Sturmlechner
2019-10-06 17:42 Andreas Sturmlechner
2018-04-24 8:48 Lars Wendler
2017-09-30 12:44 Andreas Sturmlechner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1536408228.e1215ae690131a79d311de83a1b26259ed0d09eb.asturm@gentoo \
--to=asturm@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox