From c461e47905b19a59ef627f135475a32c47541e2b73ff099aca3e629188086453 Mon Sep 17 00:00:00 2001 From: Fabian Vogt Date: Fri, 28 Jun 2019 06:54:47 +0000 Subject: [PATCH] Accepting request 712340 from home:wolfi323:test - Add upstream patch to fix downloaded files (via http) getting an "invalid" modification time (boo#1104595, kde#374420) * copyjob-Only-set-modification-time-if-the-kio-slave-provided-it.patch OBS-URL: https://build.opensuse.org/request/show/712340 OBS-URL: https://build.opensuse.org/package/show/KDE:Frameworks5/kio?expand=0&rev=260 --- ...on-time-if-the-kio-slave-provided-it.patch | 42 +++++++++++++++++++ kio.changes | 7 ++++ kio.spec | 2 + 3 files changed, 51 insertions(+) create mode 100644 copyjob-Only-set-modification-time-if-the-kio-slave-provided-it.patch diff --git a/copyjob-Only-set-modification-time-if-the-kio-slave-provided-it.patch b/copyjob-Only-set-modification-time-if-the-kio-slave-provided-it.patch new file mode 100644 index 0000000..fbff694 --- /dev/null +++ b/copyjob-Only-set-modification-time-if-the-kio-slave-provided-it.patch @@ -0,0 +1,42 @@ +From 5e791ef216c230efc15b853c08b21d41eca65e0c Mon Sep 17 00:00:00 2001 +From: Wolfgang Bauer +Date: Fri, 21 Jun 2019 15:30:48 +0200 +Subject: [copyjob] Only set modification time if the kio-slave provided it + +If the slave didn't pass a modification time (e.g. the http slave +doesn't), it was set to -1, resulting in setting a wrong modification +time for the destination file in copyNextFile() later on because that +case wasn't checked. + +So only set info.mtime when the slave actually provided a value. + +There's no need for further checks later in copyNextFile() (where +FileCopyJob::setModificationTime() is called) because FileCopyJob checks +for validity anyway. + +BUG: 374420 +FIXED-IN: 5.60.0 +Differential Revision: https://phabricator.kde.org/D21955 +--- + src/core/copyjob.cpp | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/src/core/copyjob.cpp b/src/core/copyjob.cpp +index 7288a26..0a14edc 100644 +--- a/src/core/copyjob.cpp ++++ b/src/core/copyjob.cpp +@@ -664,7 +664,10 @@ void CopyJobPrivate::addCopyInfoFromUDSEntry(const UDSEntry &entry, const QUrl & + { + struct CopyInfo info; + info.permissions = entry.numberValue(KIO::UDSEntry::UDS_ACCESS, -1); +- info.mtime = QDateTime::fromMSecsSinceEpoch(1000 * entry.numberValue(KIO::UDSEntry::UDS_MODIFICATION_TIME, -1), Qt::UTC); ++ const auto timeVal = entry.numberValue(KIO::UDSEntry::UDS_MODIFICATION_TIME, -1); ++ if (timeVal != -1) { ++ info.mtime = QDateTime::fromMSecsSinceEpoch(1000 * timeVal, Qt::UTC); ++ } + info.ctime = QDateTime::fromMSecsSinceEpoch(1000 * entry.numberValue(KIO::UDSEntry::UDS_CREATION_TIME, -1), Qt::UTC); + info.size = static_cast(entry.numberValue(KIO::UDSEntry::UDS_SIZE, -1)); + +-- +cgit v1.1 + diff --git a/kio.changes b/kio.changes index 643262d..4cc3161 100644 --- a/kio.changes +++ b/kio.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Wed Jun 26 06:26:38 UTC 2019 - wbauer@tmo.at + +- Add upstream patch to fix downloaded files (via http) getting an + "invalid" modification time (boo#1104595, kde#374420) + * copyjob-Only-set-modification-time-if-the-kio-slave-provided-it.patch + ------------------------------------------------------------------- Sun Jun 09 07:35:12 UTC 2019 - lbeltrame@kde.org diff --git a/kio.spec b/kio.spec index 2b4b8a8..a4c0ece 100644 --- a/kio.spec +++ b/kio.spec @@ -33,6 +33,8 @@ 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: copyjob-Only-set-modification-time-if-the-kio-slave-provided-it.patch BuildRequires: cmake >= 3.0 BuildRequires: extra-cmake-modules >= %{_kf5_bugfix_version} BuildRequires: fdupes