D21955: [copyjob] Only set modification time if the kio-slave provided it

Wolfgang Bauer noreply at phabricator.kde.org
Fri Jun 21 11:07:33 BST 2019


wbauer created this revision.
wbauer added a reviewer: Frameworks.
wbauer added a project: Frameworks.
Herald added a subscriber: kde-frameworks-devel.
wbauer requested review of this revision.

REVISION SUMMARY
  If the slave didn't pass a modification time (e.g. the http slave doesn't), it is set to -1 in line#672:
  
    info.mtime = QDateTime::fromMSecsSinceEpoch(1000 * entry.numberValue(KIO::UDSEntry::UDS_MODIFICATION_TIME, -1), Qt::UTC);
  
  This results in setting a wrong modification time for the destination file in `copyNextFile()` later on.
  
  To fix this, only set the modfication time if it is not -1.
  
  The Qt4 version had the same check, but this got lost in the port to Qt5.
  
  BUG: 374420

TEST PLAN
  Run `kioclient5 copy "http://kde.org" /tmp/file` and check the times with `stat`.
  
  Before:
  $ kioclient5 copy "http://kde.org" /tmp/file
  $ LANG=C stat /tmp/file
  
    File: /tmp/file
    Size: 19655           Blocks: 40         IO Block: 4096   regular file
  
  Device: 39h/57d Inode: 91809       Links: 1
  Access: (0644/-rw-r--r--)  Uid: ( 1000/   wolfi)   Gid: (  100/   users)
  Access: 2019-06-21 11:08:08.000000000 +0200
  Modify: 1970-01-01 00:59:59.000000000 +0100
  Change: 2019-06-21 11:08:08.288032833 +0200
   Birth: -
  
  (note the "Modify" time)
  
  With this patch:
  $kioclient5 copy "http://kde.org" /tmp/file
  $ LANG=C stat /tmp/file
  
    File: /tmp/file
    Size: 19655           Blocks: 40         IO Block: 4096   regular file
  
  Device: 39h/57d Inode: 91946       Links: 1
  Access: (0644/-rw-r--r--)  Uid: ( 1000/   wolfi)   Gid: (  100/   users)
  Access: 2019-06-21 11:28:20.369808804 +0200
  Modify: 2019-06-21 11:28:20.397808804 +0200
  Change: 2019-06-21 11:28:20.397808804 +0200
   Birth: -

REPOSITORY
  R241 KIO

REVISION DETAIL
  https://phabricator.kde.org/D21955

AFFECTED FILES
  src/core/copyjob.cpp

To: wbauer, #frameworks
Cc: kde-frameworks-devel, #dolphin, LeGast00n, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20190621/fa0eb9da/attachment.html>


More information about the Kde-frameworks-devel mailing list