summaryrefslogtreecommitdiff
path: root/net-p2p/ktorrent
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2019-10-13 22:19:36 +0100
committerV3n3RiX <venerix@redcorelinux.org>2019-10-14 23:22:23 +0100
commit4b19be30aa626b327c885dae62c559ec0e9fb935 (patch)
tree76e74807bc479502e13866b581b6bf86734ec634 /net-p2p/ktorrent
parent30d6f67c98d149508509d5e86f176d558793acc0 (diff)
gentoo resync : 13.10.2019
Diffstat (limited to 'net-p2p/ktorrent')
-rw-r--r--net-p2p/ktorrent/Manifest3
-rw-r--r--net-p2p/ktorrent/files/ktorrent-5.1.2-crash-on-exit.patch386
-rw-r--r--net-p2p/ktorrent/ktorrent-5.1.2-r2.ebuild (renamed from net-p2p/ktorrent/ktorrent-5.1.2-r1.ebuild)5
3 files changed, 392 insertions, 2 deletions
diff --git a/net-p2p/ktorrent/Manifest b/net-p2p/ktorrent/Manifest
index 1c7ee445f515..1f7ffe4b5eb6 100644
--- a/net-p2p/ktorrent/Manifest
+++ b/net-p2p/ktorrent/Manifest
@@ -3,8 +3,9 @@ AUX ktorrent-5.1.1-kdehig.patch 1320 BLAKE2B b34d97f8e55358e97a898c6c4e0b88040a4
AUX ktorrent-5.1.1-missing-header.patch 609 BLAKE2B 9d27522bb0309775dd330447993ba13d6b2730de74a241ebf091b9fe96a41fa157bf34ac4ec95820ce285c7305f8ebed9010a74af82fc8a26116bb68a95f60cb SHA512 571736ad190d2e75e5d6e1457d688e177388477e346e18f37c05bc74b9d97d3834897d0352b09c6469f3d5e996b093b827ebc0e5054005b8cfa5a5fc5b9fda16
AUX ktorrent-5.1.1-scanfolder-memcorruption.patch 2244 BLAKE2B 53efe0320124f954adff60144981d740e5cdf45ed4712fa43f112bb6133fb24b4303e6f969d9a73598525dea4f6706c22e57d2e5c7378c69e494dd924360a307 SHA512 8d3868a6f75e2f53fa11762378a676736df09e14e6fbde04f0dcfb45eb56e8b739d17b3ea96af4be21edb22edad610982865b33508847f07ac2eba744f62ae5e
AUX ktorrent-5.1.1-singlefile-torrent.patch 4654 BLAKE2B 8bef064068df9db5b82eb16e5ca04bb618378c94a5d218654aabb5e49dcc5db1a8b8fd92a4ed6e3e922f8a2eebdf23f4d460261fd396b7a7b8319cc102dce9f8 SHA512 e74632a86967440733ed0d3da9249a04dfe401d3966bc385581b5ba5e50e864b288fb0ca4e1ac17b754289fd8aeb70119f8c1981e9478afff434e17138beb151
+AUX ktorrent-5.1.2-crash-on-exit.patch 13261 BLAKE2B 735100f666ad7b6d0dccfcf3b5cd8582b52a6d818cd76e6ceb10e5a4a57e488eff625a94002156a5d01480c6f87e4dd05d5d5669b9accbe2973ac586bd4ef820 SHA512 5ba7b1c9bea3eae2886d2e6c6394464077b56cf1e77322a504ddb200db7a0b4130d6fdf75bfe7d3d9786c7c5507d8cb0b48c387cdf0eb77c54f9e8510287568b
DIST ktorrent-5.1.1.tar.xz 2049392 BLAKE2B 09ad841e1b6d7f332b19e2a660130b1f2b998cd6839614800cde7c99c8ec7f119f2adbdc3d9e06c8525e2dde534d73dab521c7df1d01b2fd0eb6b11fbb868d8f SHA512 bbe744853018380e30efc6ef95916a9b6f0ebec812d70d7970e5e7183d860d147b0693dd0107b146a5987aa27f30cd335fad73c8967839d53eee1c5b63a53c06
DIST ktorrent-5.1.2.tar.xz 2048604 BLAKE2B 761df1e0aab5c4457311ae821a47ebf7b5b82b2839b4bf238491231caa213370cc649a1c0cafd332b42bbb84230f4a313e5172db722ff3c7af81c0daba450a98 SHA512 b62d05650216721299dc9db23da1a2d6ae5d3b77583ad4bd99ac032d7b135cce567feff3b66d27ac001d77e30517112e4e8c8bf8e83c1106a79509ec45498621
EBUILD ktorrent-5.1.1-r1.ebuild 3192 BLAKE2B 5d0e9eb5e8a38f4f81c1928158f96973695f179fe7e423317e00959627ea2b66547d1ad043297898dd06ddb230735c1999180c3b43e7385d44689b4b74053ace SHA512 ee10006a6f529e1860f9499cf85df90e19ec8f2c39d03c714465e8a72104bfd82ee09b062f56307c9483f579d1df646549d2bd17df4a77f62e4b9ad3cec31899
-EBUILD ktorrent-5.1.2-r1.ebuild 3063 BLAKE2B 2cdcf72ed9b3d6193d289d1630c9c79c6c75fdebda904c010a39600babe1567f5d81e7d8a5a6855e49cc2903ee0bfb86a94b810680de2e7023e5b0fc8cc42827 SHA512 4ce7cfe84a0136e7bbadd2ffd08239b9eb064a00ba05066ff7e2dc0643ed69507119b9e29d3a5922814754fbee6f5ea12e33a257142e8bb2a5dff043a5d0bb75
+EBUILD ktorrent-5.1.2-r2.ebuild 3118 BLAKE2B a4d3853d387bf201e40df11167bbca60693b5140c6d8ea4d3dd8224f138afbef6445479552ed9731f88e9dc75c971890b5a59685b200a542dfd64dcb1a267ad9 SHA512 7585567f8ee55a9e50b447c02c9a01ccc340c977a9c339b87f0777ed4e9dab562867dc76a594370d915d9a56f608b5cb66e9503e5a090ee573fd3028bde37de1
MISC metadata.xml 1341 BLAKE2B 91b9b58b6df009f42960708b09f926b3bdf6849ebffd8d46114c28c7f2df2c0972a8b5460333ac6758f138729a7c689f6a61d4a58494bc44af2e364d1dbc3e05 SHA512 dfff24b08dba8615c983c1360fe10efcb60744651d5484a8bd1a7a731697b9dd4a10126b8d66276f96a8524352b1e4ba99b28b773d292362b3f7506a45da5a80
diff --git a/net-p2p/ktorrent/files/ktorrent-5.1.2-crash-on-exit.patch b/net-p2p/ktorrent/files/ktorrent-5.1.2-crash-on-exit.patch
new file mode 100644
index 000000000000..5cb6640d16f4
--- /dev/null
+++ b/net-p2p/ktorrent/files/ktorrent-5.1.2-crash-on-exit.patch
@@ -0,0 +1,386 @@
+From b819ef6a35495e12a204cbb241cdb2502c4cd11e Mon Sep 17 00:00:00 2001
+From: Valerii Malov <jazzvoid@gmail.com>
+Date: Sun, 22 Sep 2019 21:20:47 +0300
+Subject: Cleanup ViewModel a bit and try to fix crash on exit
+
+Summary:
+removeTorrent makes changes to torrent list we are currently iterating
+on per-item basis, this causees heap-use-after-free in onExit
+Just call removeRows which should be functionally the same, but should
+delete all items in one batch
+
+CCBUG: 383127
+
+Compact ViewModel::Item::update
+Fix a few warnings (0 as nullptr, c-style casts)
+Remove useless ViewModel::torrentFromIndex variant
+Remove unused headers
+add CMakeLists.txt.user to gitignore
+
+Test Plan: build with asan, run & exit, see asan stacktrace before changing onExit
+
+Reviewers: stikonas
+
+Differential Revision: https://phabricator.kde.org/D24149
+---
+ .gitignore | 1 +
+ ktorrent/CMakeLists.txt | 1 +
+ ktorrent/view/viewmodel.cpp | 197 ++++++++++++--------------------------------
+ ktorrent/view/viewmodel.h | 21 +++--
+ 4 files changed, 63 insertions(+), 157 deletions(-)
+
+diff --git a/.gitignore b/.gitignore
+index 2ad76d6..d88e731 100644
+--- a/.gitignore
++++ b/.gitignore
+@@ -1,3 +1,4 @@
+ build
+ .kdev4/
+ ktorrent.kdev4
++CMakeLists.txt.user
+diff --git a/ktorrent/CMakeLists.txt b/ktorrent/CMakeLists.txt
+index 75ba8a1..bf605a5 100644
+--- a/ktorrent/CMakeLists.txt
++++ b/ktorrent/CMakeLists.txt
+@@ -91,6 +91,7 @@ set(KTORRENT_ICONS_PNG
+ ecm_add_app_icon(ktorrent_SRC ICONS ${KTORRENT_ICONS_PNG})
+
+ add_executable(ktorrent_app ${ktorrent_SRC})
++set_property(TARGET ktorrent_app PROPERTY CXX_STANDARD 14)
+ set_target_properties(ktorrent_app PROPERTIES OUTPUT_NAME ktorrent)
+
+ target_link_libraries(ktorrent_app
+diff --git a/ktorrent/view/viewmodel.cpp b/ktorrent/view/viewmodel.cpp
+index 6834186..b9feeab 100644
+--- a/ktorrent/view/viewmodel.cpp
++++ b/ktorrent/view/viewmodel.cpp
+@@ -32,18 +32,17 @@
+
+ #include <KLocalizedString>
+
+-#include <util/log.h>
+-#include <util/sha1hash.h>
+-#include <util/functions.h>
++#include <groups/group.h>
+ #include <interfaces/torrentinterface.h>
+-#include <interfaces/trackerinterface.h>
+-#include <torrent/timeestimator.h>
+ #include <torrent/queuemanager.h>
+-#include <groups/group.h>
++#include <torrent/timeestimator.h>
++#include <util/functions.h>
++#include <util/sha1hash.h>
++
+ #include "core.h"
+-#include "viewdelegate.h"
+-#include "view.h"
+ #include "settings.h"
++#include "view.h"
++#include "viewdelegate.h"
+
+ using namespace bt;
+
+@@ -80,125 +79,45 @@ namespace kt
+ {
+ bool ret = false;
+ const TorrentStats& s = tc->getStats();
+- if (status != s.status)
+- {
+- to_update.append(model->index(row, NAME));
+- status = s.status;
+- if (sort_column == NAME)
+- ret = true;
+- }
+-
+- if (bytes_downloaded != s.bytes_downloaded)
+- {
+- to_update.append(model->index(row, BYTES_DOWNLOADED));
+- bytes_downloaded = s.bytes_downloaded;
+- if (sort_column == BYTES_DOWNLOADED)
+- ret = true;
+- }
+-
+- if (total_bytes_to_download != s.total_bytes_to_download)
+- {
+- to_update.append(model->index(row, TOTAL_BYTES_TO_DOWNLOAD));
+- total_bytes_to_download = s.total_bytes_to_download;
+- if (sort_column == TOTAL_BYTES_TO_DOWNLOAD)
+- ret = true;
+- }
+-
+- if (bytes_uploaded != s.bytes_uploaded)
+- {
+- to_update.append(model->index(row, BYTES_UPLOADED));
+- bytes_uploaded = s.bytes_uploaded;
+- if (sort_column == BYTES_UPLOADED)
+- ret = true;
+- }
+-
+- if (bytes_left != s.bytes_left_to_download)
+- {
+- to_update.append(model->index(row, BYTES_LEFT));
+- bytes_left = s.bytes_left_to_download;
+- if (sort_column == BYTES_LEFT)
+- ret = true;
+- }
+-
+- if (download_rate != s.download_rate)
+- {
+- to_update.append(model->index(row, DOWNLOAD_RATE));
+- download_rate = s.download_rate;
+- if (sort_column == DOWNLOAD_RATE)
+- ret = true;
+- }
+-
+- if (upload_rate != s.upload_rate)
+- {
+- to_update.append(model->index(row, UPLOAD_RATE));
+- upload_rate = s.upload_rate;
+- if (sort_column == UPLOAD_RATE)
+- ret = true;
+- }
+
+- int neta = tc->getETA();
+- if (eta != neta)
+- {
+- to_update.append(model->index(row, ETA));
+- eta = neta;
+- if (sort_column == ETA)
+- ret = true;
+- }
+-
+- if (seeders_connected_to != s.seeders_connected_to || seeders_total != s.seeders_total)
+- {
+- to_update.append(model->index(row, SEEDERS));
+- seeders_connected_to = s.seeders_connected_to;
+- seeders_total = s.seeders_total;
+- if (sort_column == SEEDERS)
+- ret = true;
+- }
+-
+- if (leechers_total != s.leechers_total || leechers_connected_to != s.leechers_connected_to)
+- {
+- to_update.append(model->index(row, LEECHERS));
+- leechers_total = s.leechers_total;
+- leechers_connected_to = s.leechers_connected_to;
+- if (sort_column == LEECHERS)
+- ret = true;
+- }
+-
+- double perc = Percentage(s);
+- if (fabs(percentage - perc) > 0.001)
+- {
+- to_update.append(model->index(row, PERCENTAGE));
+- percentage = perc;
+- if (sort_column == PERCENTAGE)
+- ret = true;
+- }
+-
+- float ratio = s.shareRatio();
+- if (fabsf(share_ratio - ratio) > 0.001)
+- {
+- to_update.append(model->index(row, SHARE_RATIO));
+- share_ratio = ratio;
+- if (sort_column == SHARE_RATIO)
+- ret = true;
+- }
++ const auto update_if_differs = [&](auto &target, const auto &source, int column){
++ if (target != source) {
++ to_update.append(model->index(row, column));
++ target = source;
++ ret |= (sort_column == column);
++ }
++ };
+
+- Uint32 rdl = tc->getRunningTimeDL();
+- if (runtime_dl != rdl)
+- {
+- to_update.append(model->index(row, DOWNLOAD_TIME));
+- runtime_dl = rdl;
+- if (sort_column == DOWNLOAD_TIME)
+- ret = true;
+- }
++ const auto update_if_differs_float = [&](auto &target, const auto &source, int column){
++ if (fabs(target - source) > 0.001) {
++ to_update.append(model->index(row, column));
++ target = source;
++ ret |= (sort_column == column);
++ }
++ };
++
++ update_if_differs(status, s.status, NAME);
++ update_if_differs(bytes_downloaded, s.bytes_downloaded, BYTES_DOWNLOADED);
++ update_if_differs(total_bytes_to_download, s.total_bytes_to_download, TOTAL_BYTES_TO_DOWNLOAD);
++ update_if_differs(bytes_uploaded, s.bytes_uploaded, BYTES_UPLOADED);
++ update_if_differs(bytes_left, s.bytes_left, BYTES_LEFT);
++ update_if_differs(download_rate, s.download_rate, DOWNLOAD_RATE);
++ update_if_differs(upload_rate, s.upload_rate, UPLOAD_RATE);
++ update_if_differs(eta, tc->getETA(), ETA);
++ update_if_differs(seeders_connected_to, s.seeders_connected_to, SEEDERS);
++ update_if_differs(seeders_total, s.seeders_total, SEEDERS);
++ update_if_differs(leechers_connected_to, s.leechers_connected_to, LEECHERS);
++ update_if_differs(leechers_total, s.leechers_total, LEECHERS);
++
++ update_if_differs_float(percentage, Percentage(s), PERCENTAGE);
++ update_if_differs_float(share_ratio, s.shareRatio(), SHARE_RATIO);
++
++ update_if_differs(runtime_dl, tc->getRunningTimeDL(), DOWNLOAD_TIME);
++ const auto rul = (tc->getRunningTimeUL() >= tc->getRunningTimeDL()
++ ? tc->getRunningTimeUL() - tc->getRunningTimeDL()
++ : 0);
++ update_if_differs(runtime_ul, rul, SEED_TIME);
+
+- Uint32 rul = tc->getRunningTimeUL();
+- rul = rul >= rdl ? rul - rdl : 0; // make sure rul cannot go negative
+- if (runtime_ul != rul)
+- {
+- to_update.append(model->index(row, SEED_TIME));
+- runtime_ul = rul;
+- if (sort_column == SEED_TIME)
+- ret = true;
+- }
+ return ret;
+ }
+
+@@ -223,13 +142,11 @@ namespace kt
+ return BytesPerSecToString(download_rate);
+ else
+ return QVariant();
+- break;
+ case UPLOAD_RATE:
+ if (upload_rate >= 103) // lowest "visible" speed, all below will be 0,0 Kb/s
+ return BytesPerSecToString(upload_rate);
+ else
+ return QVariant();
+- break;
+ case ETA:
+ if (eta == bt::TimeEstimator::NEVER)
+ return QString(QChar(0x221E)); // infinity
+@@ -237,7 +154,6 @@ namespace kt
+ return DurationToString(eta);
+ else
+ return QVariant();
+- break;
+ case SEEDERS:
+ return QString(QString::number(seeders_connected_to) + QLatin1String(" (") + QString::number(seeders_total) + QLatin1Char(')'));
+ case LEECHERS:
+@@ -397,7 +313,7 @@ namespace kt
+ connect(core, &Core::torrentRemoved, this, &ViewModel::removeTorrent);
+ sort_column = 0;
+ sort_order = Qt::AscendingOrder;
+- group = 0;
++ group = nullptr;
+ num_visible = 0;
+
+ kt::QueueManager* qman = core->getQueueManager();
+@@ -635,7 +551,7 @@ namespace kt
+ if (!index.isValid() || index.row() >= torrents.count())
+ return QVariant();
+
+- Item* item = (Item*)index.internalPointer();
++ Item* item = reinterpret_cast<Item*>(index.internalPointer());
+ if (!item)
+ return QVariant();
+
+@@ -699,7 +615,7 @@ namespace kt
+ return false;
+
+ QString name = value.toString();
+- Item* item = (Item*)index.internalPointer();
++ Item* item = reinterpret_cast<Item*>(index.internalPointer());
+ if (!item)
+ return false;
+
+@@ -796,28 +712,20 @@ namespace kt
+ }
+ }
+
+- const bt::TorrentInterface* ViewModel::torrentFromIndex(const QModelIndex& index) const
+- {
+- if (index.isValid() && index.row() < torrents.count())
+- return torrents[index.row()]->tc;
+- else
+- return 0;
+- }
+-
+- bt::TorrentInterface* ViewModel::torrentFromIndex(const QModelIndex& index)
++ bt::TorrentInterface* ViewModel::torrentFromIndex(const QModelIndex& index) const
+ {
+ if (index.isValid() && index.row() < torrents.count())
+ return torrents[index.row()]->tc;
+ else
+- return 0;
++ return nullptr;
+ }
+
+- bt::TorrentInterface* ViewModel::torrentFromRow(int index)
++ bt::TorrentInterface* ViewModel::torrentFromRow(int index) const
+ {
+ if (index < torrents.count() && index >= 0)
+ return torrents[index]->tc;
+ else
+- return 0;
++ return nullptr;
+ }
+
+ void ViewModel::allTorrents(QList<bt::TorrentInterface*> & tlist) const
+@@ -854,10 +762,7 @@ namespace kt
+ void ViewModel::onExit()
+ {
+ // items should be removed before Core delete their tc data.
+- for (Item* item : qAsConst(torrents))
+- {
+- removeTorrent(item->tc);
+- }
++ removeRows(0, rowCount(), QModelIndex());
+ }
+
+ class ViewModelItemCmp
+diff --git a/ktorrent/view/viewmodel.h b/ktorrent/view/viewmodel.h
+index d4e0a64..6422396 100644
+--- a/ktorrent/view/viewmodel.h
++++ b/ktorrent/view/viewmodel.h
+@@ -22,9 +22,15 @@
+ #ifndef KTVIEWMODEL_H
+ #define KTVIEWMODEL_H
+
+-#include <QList>
+ #include <QAbstractTableModel>
+-#include <interfaces/torrentinterface.h>
++#include <QList>
++
++#include <torrent/torrentstats.h>
++#include <util/constants.h>
++
++namespace bt {
++ class TorrentInterface;
++}
+
+ namespace kt
+ {
+@@ -98,21 +104,14 @@ namespace kt
+ * @param index The model index
+ * @return The torrent if the index is valid and in the proper range, 0 otherwise
+ */
+- const bt::TorrentInterface* torrentFromIndex(const QModelIndex& index) const;
+-
+- /**
+- * Get a torrent from a model index.
+- * @param index The model index
+- * @return The torrent if the index is valid and in the proper range, 0 otherwise
+- */
+- bt::TorrentInterface* torrentFromIndex(const QModelIndex& index);
++ bt::TorrentInterface *torrentFromIndex(const QModelIndex& index) const;
+
+ /**
+ * Get a torrent from a row.
+ * @param index The row index
+ * @return The torrent if the index is valid and in the proper range, 0 otherwise
+ */
+- bt::TorrentInterface* torrentFromRow(int index);
++ bt::TorrentInterface* torrentFromRow(int index) const;
+
+ /**
+ * Get all torrents
+--
+cgit v1.1
diff --git a/net-p2p/ktorrent/ktorrent-5.1.2-r1.ebuild b/net-p2p/ktorrent/ktorrent-5.1.2-r2.ebuild
index af5cd52308e7..a23633e653d4 100644
--- a/net-p2p/ktorrent/ktorrent-5.1.2-r1.ebuild
+++ b/net-p2p/ktorrent/ktorrent-5.1.2-r2.ebuild
@@ -76,7 +76,10 @@ RDEPEND="${COMMON_DEPEND}
)
"
-PATCHES=( "${FILESDIR}/${PN}-5.1.1-singlefile-torrent.patch" ) # git master
+PATCHES=(
+ "${FILESDIR}/${PN}-5.1.1-singlefile-torrent.patch" # git master
+ "${FILESDIR}/${P}-crash-on-exit.patch" # bug #632588
+)
src_configure() {
local mycmakeargs=(