[Pkg-owncloud-commits] [owncloud-client] 61/219: SyncEngine: Abort sync with error if system exclude file is missing.

Sandro Knauß hefee-guest at moszumanska.debian.org
Sat Oct 11 14:43:10 UTC 2014


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 a48bf3142c19830290d6aeba7f6207a15bc44e48
Author: Christian Kamm <kamm at incasoftware.de>
Date:   Wed Sep 3 14:25:14 2014 +0200

    SyncEngine: Abort sync with error if system exclude file is missing.
    
    Syncing without the system exclude file would cause lots of trouble.
    For instance we would try uploading the temporary files we store
    partially completed downloads in.
---
 src/mirall/folder.cpp | 20 ++++++++++++++++----
 src/mirall/folder.h   |  2 +-
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/src/mirall/folder.cpp b/src/mirall/folder.cpp
index 914a342..4b07426 100644
--- a/src/mirall/folder.cpp
+++ b/src/mirall/folder.cpp
@@ -529,20 +529,26 @@ void Folder::wipe()
     }
 }
 
-void Folder::setIgnoredFiles()
+bool Folder::setIgnoredFiles()
 {
+    bool ok = false;
+
     MirallConfigFile cfgFile;
     csync_clear_exclude_list( _csync_ctx );
     QString excludeList = cfgFile.excludeFile( MirallConfigFile::SystemScope );
     if( !excludeList.isEmpty() ) {
         qDebug() << "==== added system ignore list to csync:" << excludeList.toUtf8();
-        csync_add_exclude_list( _csync_ctx, excludeList.toUtf8() );
+        if (csync_add_exclude_list( _csync_ctx, excludeList.toUtf8() ) != -1)
+            ok = true;
     }
     excludeList = cfgFile.excludeFile( MirallConfigFile::UserScope );
     if( !excludeList.isEmpty() ) {
         qDebug() << "==== added user defined ignore list to csync:" << excludeList.toUtf8();
         csync_add_exclude_list( _csync_ctx, excludeList.toUtf8() );
+        // reading the user exclude file is optional
     }
+
+    return ok;
 }
 
 void Folder::setProxyDirty(bool value)
@@ -586,9 +592,15 @@ void Folder::startSync(const QStringList &pathList)
     _syncResult.setStatus( SyncResult::SyncPrepare );
     emit syncStateChange();
 
-
     qDebug() << "*** Start syncing";
-    setIgnoredFiles();
+
+    if (! setIgnoredFiles())
+    {
+        slotSyncError(tr("Could not read system exclude file"));
+        QMetaObject::invokeMethod(this, "slotSyncFinished", Qt::QueuedConnection);
+        return;
+    }
+
     _engine.reset(new SyncEngine( _csync_ctx, path(), remoteUrl().path(), _remotePath, &_journal));
 
     qRegisterMetaType<SyncFileItemVector>("SyncFileItemVector");
diff --git a/src/mirall/folder.h b/src/mirall/folder.h
index b5eff8e..99988e7 100644
--- a/src/mirall/folder.h
+++ b/src/mirall/folder.h
@@ -177,7 +177,7 @@ private slots:
 private:
     bool init();
 
-    void setIgnoredFiles();
+    bool setIgnoredFiles();
 
     void bubbleUpSyncResult();
 

-- 
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