[Pkg-owncloud-commits] [owncloud-client] 112/159: PropagateDownload: Read the mtime from the file system after writing it

Sandro Knauß hefee-guest at moszumanska.debian.org
Fri May 1 13:05:32 UTC 2015


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit 458f336405e3b5e1837076cb53170db83dbf874a
Author: Olivier Goffart <ogoffart at woboq.com>
Date:   Wed Apr 15 15:31:47 2015 +0200

    PropagateDownload: Read the mtime from the file system after writing it
    
    Because file system like FAT only have two second accuracy and would result
    in a upload if the mtime in the database is not the same as the one that was
    downloaded
    
    Issue #3103
---
 src/libsync/propagatedownload.cpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/libsync/propagatedownload.cpp b/src/libsync/propagatedownload.cpp
index e19ee7f..98a78b4 100644
--- a/src/libsync/propagatedownload.cpp
+++ b/src/libsync/propagatedownload.cpp
@@ -519,10 +519,14 @@ void PropagateDownloadFileQNAM::downloadFinished()
         _tmpFile.setPermissions(existingFile.permissions());
     }
 
-    FileSystem::setFileHidden(_tmpFile.fileName(), false);
+    FileSystem::setModTime(_tmpFile.fileName(), _item._modtime);
+    // We need to fetch the time again because some file system such as FAT have a less than a second
+    // Accuracy, and we really need the time from the file system. (#3103)
+    _item._modtime = FileSystem::getModTime(_tmpFile.fileName());
 
     QString error;
     _propagator->addTouchedFile(fn);
+    FileSystem::setFileHidden(_tmpFile.fileName(), false);
     if (!FileSystem::renameReplace(_tmpFile.fileName(), fn, &error)) {
         qDebug() << Q_FUNC_INFO << QString("Rename failed: %1 => %2").arg(_tmpFile.fileName()).arg(fn);
         // If we moved away the original file due to a conflict but can't
@@ -543,7 +547,6 @@ void PropagateDownloadFileQNAM::downloadFinished()
 
     // Maybe we downloaded a newer version of the file than we thought we would...
     // Get up to date information for the journal.
-    FileSystem::setModTime(fn, _item._modtime);
     _item._size = FileSystem::getSize(fn);
 
     _propagator->_journal->setFileRecord(SyncJournalFileRecord(_item, fn));

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list