File smb-retain-atime-properly.patch of Package kdebase4-runtime

From 7f47119b22d526fd2ffd9451a9513dfb260a6706 Mon Sep 17 00:00:00 2001
From: Harald Sitter <sitter@kde.org>
Date: Wed, 12 Feb 2020 16:12:08 +0100
Subject: smb: retain atime properly

Summary:
this was broken since forever I guess. when the .part resume tech was
added it didn't correctly retain the access time. it was trying to
get the atime of 'file', but 'file' when resuming refers to the .part which
was deleted prior to the mtime adjustment so the QFileInfo(file).lastRead
would produce an Invalid QDateTime which then results in us setting random
nonesense as access time on the file.
instead simply use dstFile. it is the path of the actual final destination
file of which the atime is **actually** the one we want to preserve here
considering we've literally just accessed that file by copying it ^^

BUG: 410624
FIXED-IN: 19.12.3

Test Plan: copy file form smb to local has sound atime

Reviewers: ngraham, meven

Reviewed By: meven

Subscribers: kde-frameworks-devel, kfm-devel

Tags: #dolphin, #frameworks

Differential Revision: https://phabricator.kde.org/D27352
---
 kioslave/smb/kio_smb_dir.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kioslave/smb/kio_smb_dir.cpp b/kioslave/smb/kio_smb_dir.cpp
index f5e26df..85c2576 100644
--- a/kioslave/smb/kio_smb_dir.cpp
+++ b/kioslave/smb/kio_smb_dir.cpp
@@ -429,7 +429,7 @@ void SMBSlave::smbCopyGet(const KUrl& ksrc, const KUrl& kdst, int permissions, K
         QDateTime dt = QDateTime::fromString(mtimeStr, Qt::ISODate);
         if (dt.isValid()) {
             struct utimbuf utbuf;
-            utbuf.actime = QFileInfo(file).lastRead().toTime_t(); // access time, unchanged
+            utbuf.actime = QFileInfo(dstFile).lastRead().toTime_t(); // access time, unchanged
             utbuf.modtime = dt.toTime_t(); // modification time
             KDE::utime(dstFile, &utbuf);
         }
-- 
cgit v1.1

openSUSE Build Service is sponsored by