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>2019-02-11 15:25:56 +0300
committerckamm <mail@ckamm.de>2019-02-11 15:35:14 +0300
commit5673879f4065e5d5aceadff4b15046830899af63 (patch)
tree1f596c9603d16773a7393c93d5576ecfb1fd1655 /test/testsyncengine.cpp
parent5d777604f489f06bd5067e4d0811f69d97bc4a51 (diff)
Test: Add check for permission propagation
Also covering propagation to the downloaded file when a conflict-rename is done at the same time, which used to not work.
Diffstat (limited to 'test/testsyncengine.cpp')
-rw-r--r--test/testsyncengine.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/testsyncengine.cpp b/test/testsyncengine.cpp
index 4fcb1049a..cc945d032 100644
--- a/test/testsyncengine.cpp
+++ b/test/testsyncengine.cpp
@@ -676,6 +676,33 @@ private slots:
QCOMPARE(nPUT, 3);
}
+
+#ifndef Q_OS_WIN
+ void testPropagatePermissions()
+ {
+ FakeFolder fakeFolder{FileInfo::A12_B12_C12_S12()};
+ auto perm = QFileDevice::Permission(0x7704); // user/owner: rwx, group: r, other: -
+ QFile::setPermissions(fakeFolder.localPath() + "A/a1", perm);
+ QFile::setPermissions(fakeFolder.localPath() + "A/a2", perm);
+ fakeFolder.syncOnce(); // get the metadata-only change out of the way
+ fakeFolder.remoteModifier().appendByte("A/a1");
+ fakeFolder.remoteModifier().appendByte("A/a2");
+ fakeFolder.localModifier().appendByte("A/a2");
+ fakeFolder.localModifier().appendByte("A/a2");
+ fakeFolder.syncOnce(); // perms should be preserved
+ QCOMPARE(QFileInfo(fakeFolder.localPath() + "A/a1").permissions(), perm);
+ QCOMPARE(QFileInfo(fakeFolder.localPath() + "A/a2").permissions(), perm);
+
+ // Currently the umask applies to conflict files
+ auto octmask = umask(0);
+ umask(octmask);
+ // Qt uses 0x1, 0x2, 0x4 for "other"; 0x10, 0x20, 0x40 for "group" etc
+ auto qtmask = (octmask & 07) + 0x10 * ((octmask & 070) >> 3) + 0x100 * ((octmask & 0700) >> 6);
+ auto maskedPerm = QFileDevice::Permission(perm & (~qtmask));
+ auto conflictName = fakeFolder.syncJournal().conflictRecord("A/a2").path;
+ QCOMPARE(QFileInfo(fakeFolder.localPath() + conflictName).permissions(), maskedPerm);
+ }
+#endif
};
QTEST_GUILESS_MAIN(TestSyncEngine)