From 9a8b2f55a9cddd3d328e25be4a2b2b00c5ae8ac20bbaf3c5675aa778c07c16b3 Mon Sep 17 00:00:00 2001 From: Fabian Vogt Date: Mon, 14 Jan 2019 13:31:32 +0000 Subject: [PATCH] KDE Frameworks 5.54.0 OBS-URL: https://build.opensuse.org/package/show/KDE:Frameworks5/kio?expand=0&rev=243 --- 0001-Revert-Fix-elapsed-time-check.patch | 29 ++++ ...rt-Refactor-SlaveInterface-calcSpeed.patch | 144 ++++++++++++++++++ kio-5.53.0.tar.xz | 3 - kio-5.54.0.tar.xz | 3 + kio.changes | 13 ++ kio.spec | 10 +- 6 files changed, 196 insertions(+), 6 deletions(-) create mode 100644 0001-Revert-Fix-elapsed-time-check.patch create mode 100644 0002-Revert-Refactor-SlaveInterface-calcSpeed.patch delete mode 100644 kio-5.53.0.tar.xz create mode 100644 kio-5.54.0.tar.xz diff --git a/0001-Revert-Fix-elapsed-time-check.patch b/0001-Revert-Fix-elapsed-time-check.patch new file mode 100644 index 0000000..b2c8a0a --- /dev/null +++ b/0001-Revert-Fix-elapsed-time-check.patch @@ -0,0 +1,29 @@ +From 0362f77d51b2fc9c784ab8fa751ee6ffac33eb00 Mon Sep 17 00:00:00 2001 +From: Fabian Vogt +Date: Mon, 14 Jan 2019 13:31:39 +0100 +Subject: [PATCH 1/2] Revert "Fix elapsed time check" + +This reverts commit cd2f67c39b25de026390bfe2bc1c7aa269f78ccb. +In preparation for reverting the calcSpeed rewrite. +--- + src/core/slaveinterface.cpp | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/src/core/slaveinterface.cpp b/src/core/slaveinterface.cpp +index d79b498d..6eb2b08d 100644 +--- a/src/core/slaveinterface.cpp ++++ b/src/core/slaveinterface.cpp +@@ -103,9 +103,7 @@ void SlaveInterface::calcSpeed() + // using first and last item from the list. + + const qint64 elapsed_time = d->elapsed_timer.elapsed(); +- const qint64 last_time = d->transfer_details.isEmpty() ? 0 : d->transfer_details.last().time; +- +- if (elapsed_time - last_time >= 900) { ++ if (elapsed_time >= 900) { + if (d->transfer_details.count() == max_count) { + d->transfer_details.removeFirst(); + } +-- +2.20.1 + diff --git a/0002-Revert-Refactor-SlaveInterface-calcSpeed.patch b/0002-Revert-Refactor-SlaveInterface-calcSpeed.patch new file mode 100644 index 0000000..ecd7fab --- /dev/null +++ b/0002-Revert-Refactor-SlaveInterface-calcSpeed.patch @@ -0,0 +1,144 @@ +From b8a5f34b34b6c4e37684fe2782b8cf39c38cd928 Mon Sep 17 00:00:00 2001 +From: Fabian Vogt +Date: Mon, 14 Jan 2019 13:32:52 +0100 +Subject: [PATCH 2/2] Revert "Refactor SlaveInterface::calcSpeed" + +This reverts commit 4e2a815b9a107663a3d75e9d9d1be336adea888e. +This commit causes crashes due to improper division and there are some +outstanding code review issues as well. + +BUG: 402665 +--- + src/core/slaveinterface.cpp | 48 ++++++++++++++++++++++++------------- + src/core/slaveinterface_p.h | 19 +++++++-------- + 2 files changed, 39 insertions(+), 28 deletions(-) + +diff --git a/src/core/slaveinterface.cpp b/src/core/slaveinterface.cpp +index 6eb2b08d..88f649c8 100644 +--- a/src/core/slaveinterface.cpp ++++ b/src/core/slaveinterface.cpp +@@ -45,7 +45,6 @@ SlaveInterface::SlaveInterface(SlaveInterfacePrivate &dd, QObject *parent) + : QObject(parent), d_ptr(&dd) + { + connect(&d_ptr->speed_timer, &QTimer::timeout, this, &SlaveInterface::calcSpeed); +- d_ptr->transfer_details.reserve(max_count); + } + + SlaveInterface::~SlaveInterface() +@@ -98,24 +97,36 @@ void SlaveInterface::calcSpeed() + return; + } + +- // Note for future reference: A list is maintained for sizes and times. +- // Minimum list size is 1 and maximum list size is 8. Delta is calculated +- // using first and last item from the list. +- +- const qint64 elapsed_time = d->elapsed_timer.elapsed(); +- if (elapsed_time >= 900) { +- if (d->transfer_details.count() == max_count) { +- d->transfer_details.removeFirst(); ++ const qint64 currentTime = QDateTime::currentMSecsSinceEpoch(); ++ const qint64 diff = currentTime - d->start_time; ++ if (diff - d->last_time >= 900) { ++ d->last_time = diff; ++ if (d->nums == max_nums) { ++ // let's hope gcc can optimize that well enough ++ // otherwise I'd try memcpy :) ++ for (unsigned int i = 1; i < max_nums; ++i) { ++ d->times[i - 1] = d->times[i]; ++ d->sizes[i - 1] = d->sizes[i]; ++ } ++ d->nums--; + } ++ d->times[d->nums] = diff; ++ d->sizes[d->nums++] = d->filesize - d->offset; ++ ++ KIO::filesize_t lspeed = 1000 * (d->sizes[d->nums - 1] - d->sizes[0]) / (d->times[d->nums - 1] - d->times[0]); ++ ++//qDebug() << (long)d->filesize << diff ++// << long(d->sizes[d->nums-1] - d->sizes[0]) ++// << d->times[d->nums-1] - d->times[0] ++// << long(lspeed) << double(d->filesize) / diff ++// << convertSize(lspeed) ++// << convertSize(long(double(d->filesize) / diff) * 1000); + +- const SlaveInterfacePrivate::TransferInfo first = d->transfer_details.first(); +- const SlaveInterfacePrivate::TransferInfo last = {elapsed_time, (d->filesize - d->offset)}; +- KIO::filesize_t lspeed = 1000 * (last.size - first.size) / (last.time - first.time); + if (!lspeed) { +- d->transfer_details.clear(); ++ d->nums = 1; ++ d->times[0] = diff; ++ d->sizes[0] = d->filesize - d->offset; + } +- d->transfer_details.append(last); +- + emit speed(lspeed); + } + } +@@ -198,10 +209,13 @@ bool SlaveInterface::dispatch(int _cmd, const QByteArray &rawdata) + } + case INF_TOTAL_SIZE: { + KIO::filesize_t size = readFilesize_t(stream); ++ d->start_time = QDateTime::currentMSecsSinceEpoch(); ++ d->last_time = 0; + d->filesize = d->offset; +- d->transfer_details.append({0, 0}); ++ d->sizes[0] = d->filesize - d->offset; ++ d->times[0] = 0; ++ d->nums = 1; + d->speed_timer.start(1000); +- d->elapsed_timer.start(); + d->slave_calcs_speed = false; + emit totalSize(size); + break; +diff --git a/src/core/slaveinterface_p.h b/src/core/slaveinterface_p.h +index efb17d0f..a4cb5d3f 100644 +--- a/src/core/slaveinterface_p.h ++++ b/src/core/slaveinterface_p.h +@@ -29,19 +29,17 @@ + #include + #include + #include +-#include +-#include + + #include "kiocoredebug.h" + +-static const unsigned int max_count = 8; ++static const unsigned int max_nums = 8; + + class KIO::SlaveInterfacePrivate + { + public: + SlaveInterfacePrivate() +- : connection(nullptr), filesize(0), offset(0), +- slave_calcs_speed(false) ++ : connection(nullptr), filesize(0), offset(0), last_time(0), start_time(0), ++ nums(0), slave_calcs_speed(false) + { + } + virtual ~SlaveInterfacePrivate() +@@ -55,14 +53,13 @@ public: + // We need some metadata here for our SSL code in messageBox() and for sslMetaData(). + MetaData sslMetaData; + +- struct TransferInfo { +- qint64 time; +- KIO::filesize_t size; +- }; +- QVector transfer_details; +- QElapsedTimer elapsed_timer; ++ KIO::filesize_t sizes[max_nums]; ++ qint64 times[max_nums]; + + KIO::filesize_t filesize, offset; ++ size_t last_time; ++ qint64 start_time; ++ uint nums; + bool slave_calcs_speed; + + void slotHostInfo(const QHostInfo &info); +-- +2.20.1 + diff --git a/kio-5.53.0.tar.xz b/kio-5.53.0.tar.xz deleted file mode 100644 index 44e14f4..0000000 --- a/kio-5.53.0.tar.xz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:7320df009b19ab9ad3acfeb0d8cf9e0824d5779930fb85f59208deb0cb4124c3 -size 3143732 diff --git a/kio-5.54.0.tar.xz b/kio-5.54.0.tar.xz new file mode 100644 index 0000000..70d51ad --- /dev/null +++ b/kio-5.54.0.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3cf05a021e6431c2d2b16525dd130a02269cb6fc2cf99ce3b4725d33c0bf5c7d +size 3150624 diff --git a/kio.changes b/kio.changes index 3686ab3..b3b1372 100644 --- a/kio.changes +++ b/kio.changes @@ -1,3 +1,16 @@ +------------------------------------------------------------------- +Mon Jan 14 06:08:48 UTC 2019 - lbeltrame@kde.org + +- Update to 5.54.0 + * New feature release + * For more details please see: + * https://www.kde.org/announcements/kde-frameworks-5.54.0.php +- Changes since 5.53.0: + * Too many changes to list here +- Add upstream patches to prevent crashes in KIO (kde#402665) + * 0001-Revert-Fix-elapsed-time-check.patch + * 0002-Revert-Refactor-SlaveInterface-calcSpeed.patch + ------------------------------------------------------------------- Sun Dec 09 19:43:44 UTC 2018 - lbeltrame@kde.org diff --git a/kio.spec b/kio.spec index 047b62b..741bf17 100644 --- a/kio.spec +++ b/kio.spec @@ -1,7 +1,7 @@ # # spec file for package kio # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,14 +16,14 @@ # -%define _tar_path 5.53 +%define _tar_path 5.54 # Full KF5 version (e.g. 5.33.0) %{!?_kf5_version: %global _kf5_version %{version}} # Last major and minor KF5 version (e.g. 5.33) %{!?_kf5_bugfix_version: %define _kf5_bugfix_version %(echo %{_kf5_version} | awk -F. '{print $1"."$2}')} %bcond_without lang Name: kio -Version: 5.53.0 +Version: 5.54.0 Release: 0 Summary: Network transparent access to files and data License: LGPL-2.1-or-later @@ -33,6 +33,10 @@ Source: http://download.kde.org/stable/frameworks/%{_tar_path}/%{name}-% Source1: baselibs.conf # PATCH-FIX-OPENSUSE kio_help-fallback-to-kde4-docs.patch -- allow kio_help to see into kde4 documentation, needed especially for khelpcenter5 Patch0: kio_help-fallback-to-kde4-docs.patch +# PATCH-FIX-UPSTREAM +Patch1: 0001-Revert-Fix-elapsed-time-check.patch +# PATCH-FIX-UPSTREAM +Patch2: 0002-Revert-Refactor-SlaveInterface-calcSpeed.patch BuildRequires: cmake >= 3.0 BuildRequires: extra-cmake-modules >= %{_kf5_bugfix_version} BuildRequires: fdupes