Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Kamm <mail@ckamm.de>2017-05-15 15:46:09 +0300
committerChristian Kamm <mail@ckamm.de>2017-05-16 14:58:45 +0300
commitc5a0ce5a43c5539b0b22ca3a5b81d327465adb5f (patch)
tree0d6bfb05887dc748cff23356cb42fecb4934b192 /test/testsyncengine.cpp
parent6d74601cf3546ec5ddf7a511a9f2214445169b65 (diff)
Selective sync: Skip excluded folders when reading db
When a new folder becomes selective-sync excluded, we already mark it and all its parent folders with _invalid_ etags to force rediscovery. That's not enough however. Later calls to csync_statedb_get_below_path could still pull data about the excluded files into the remote tree. That lead to incorrect behavior, such as uploads happening for folders that had been explicitly excluded from sync. To fix the problem, statedb_get_below_path is adjusted to not read the data about excluded folders from the database. Currently we can't wipe this data from the database outright because we need it to determine whether the files in the excluded folder can be wiped away or not. See owncloud/enterprise#1965
Diffstat (limited to 'test/testsyncengine.cpp')
-rw-r--r--test/testsyncengine.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/test/testsyncengine.cpp b/test/testsyncengine.cpp
index 2498860c2..17bf0f77f 100644
--- a/test/testsyncengine.cpp
+++ b/test/testsyncengine.cpp
@@ -213,6 +213,49 @@ private slots:
}
}
+ void testSelectiveSyncBug() {
+ // issue owncloud/enterprise#1965: files from selective-sync ignored
+ // folders are uploaded anyway is some circumstances.
+ FakeFolder fakeFolder{FileInfo{ QString(), {
+ FileInfo { QStringLiteral("parentFolder"), {
+ FileInfo{ QStringLiteral("subFolder"), {
+ { QStringLiteral("fileA.txt"), 400 },
+ { QStringLiteral("fileB.txt"), 400, 'o' }
+ }}
+ }}
+ }}};
+
+ QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
+ auto expectedServerState = fakeFolder.currentRemoteState();
+
+ // Remove subFolder with selectiveSync:
+ fakeFolder.syncEngine().journal()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList,
+ {"parentFolder/subFolder/"});
+ fakeFolder.syncEngine().journal()->avoidReadFromDbOnNextSync("parentFolder/subFolder/");
+
+ // But touch a local file before the next sync, such that the local folder
+ // can't be removed
+ fakeFolder.localModifier().setContents("parentFolder/subFolder/fileB.txt", 'n');
+
+ // Several follow-up syncs don't change the state at all,
+ // in particular the remote state doesn't change and fileB.txt
+ // isn't uploaded.
+
+ for (int i = 0; i < 3; ++i) {
+ fakeFolder.syncOnce();
+
+ {
+ // Nothing changed on the server
+ QCOMPARE(fakeFolder.currentRemoteState(), expectedServerState);
+ // The local state should still have subFolderA
+ auto local = fakeFolder.currentLocalState();
+ QVERIFY(local.find("parentFolder/subFolder"));
+ QVERIFY(local.find("parentFolder/subFolder/fileA.txt"));
+ QVERIFY(local.find("parentFolder/subFolder/fileB.txt"));
+ }
+ }
+ }
+
void abortAfterFailedMkdir() {
QSKIP("Skip for 2.3");
FakeFolder fakeFolder{FileInfo{}};