From: Christian Kamm Date: Tue, 22 Nov 2016 12:17:04 +0000 (+0100) Subject: Rename sync journal to ._sync_xxx.db. X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~976^2~7 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=9641c7a1e7789a21d877ed374c4f67061c75f16c;p=nextcloud-desktop.git Rename sync journal to ._sync_xxx.db. The added underscore means that older clients will also ignore the file. --- diff --git a/csync/src/csync_exclude.c b/csync/src/csync_exclude.c index a598893e5..bf636c3de 100644 --- a/csync/src/csync_exclude.c +++ b/csync/src/csync_exclude.c @@ -230,7 +230,7 @@ static CSYNC_EXCLUDE_TYPE _csync_excluded_common(c_strlist_t *excludes, const ch } blen = strlen(bname); - rc = csync_fnmatch(".sync_*.db*", bname, 0); + rc = csync_fnmatch("._sync_*.db*", bname, 0); if (rc == 0) { match = CSYNC_FILE_SILENTLY_EXCLUDED; goto out; diff --git a/csync/tests/csync_tests/check_csync_exclude.c b/csync/tests/csync_tests/check_csync_exclude.c index 5d5d0a82a..e7af73c67 100644 --- a/csync/tests/csync_tests/check_csync_exclude.c +++ b/csync/tests/csync_tests/check_csync_exclude.c @@ -149,13 +149,13 @@ static void check_csync_excluded(void **state) assert_int_equal(rc, CSYNC_FILE_SILENTLY_EXCLUDED); /* also the new form of the database name */ - rc = csync_excluded_no_ctx(csync->excludes, ".sync_5bdd60bdfcfa.db", CSYNC_FTW_TYPE_FILE); + rc = csync_excluded_no_ctx(csync->excludes, "._sync_5bdd60bdfcfa.db", CSYNC_FTW_TYPE_FILE); assert_int_equal(rc, CSYNC_FILE_SILENTLY_EXCLUDED); - rc = csync_excluded_no_ctx(csync->excludes, ".sync_5bdd60bdfcfa.db.ctmp", CSYNC_FTW_TYPE_FILE); + rc = csync_excluded_no_ctx(csync->excludes, "._sync_5bdd60bdfcfa.db.ctmp", CSYNC_FTW_TYPE_FILE); assert_int_equal(rc, CSYNC_FILE_SILENTLY_EXCLUDED); - rc = csync_excluded_no_ctx(csync->excludes, ".sync_5bdd60bdfcfa.db-shm", CSYNC_FTW_TYPE_FILE); + rc = csync_excluded_no_ctx(csync->excludes, "._sync_5bdd60bdfcfa.db-shm", CSYNC_FTW_TYPE_FILE); assert_int_equal(rc, CSYNC_FILE_SILENTLY_EXCLUDED); - rc = csync_excluded_no_ctx(csync->excludes, "subdir/.sync_5bdd60bdfcfa.db", CSYNC_FTW_TYPE_FILE); + rc = csync_excluded_no_ctx(csync->excludes, "subdir/._sync_5bdd60bdfcfa.db", CSYNC_FTW_TYPE_FILE); assert_int_equal(rc, CSYNC_FILE_SILENTLY_EXCLUDED); diff --git a/doc/architecture.rst b/doc/architecture.rst index cf9730287..59c7e67a1 100644 --- a/doc/architecture.rst +++ b/doc/architecture.rst @@ -153,7 +153,7 @@ By default, the ownCloud Client ignores the following files: * Files matched by one of the patterns defined in the Ignored Files Editor * Files containing characters that do not work on certain file systems ``(`\, /, :, ?, *, ", >, <, |`)``. -* Files starting with ``.sync_xxxxxxx.db`` and the old format ``.csync_journal.db``, +* Files starting with ``._sync_xxxxxxx.db`` and the old format ``.csync_journal.db``, as these files are reserved for journalling. If a pattern selected using a checkbox in the `ignoredFilesEditor-label` (or if diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp index 435ba16db..c6e3b0413 100644 --- a/src/gui/folder.cpp +++ b/src/gui/folder.cpp @@ -634,7 +634,7 @@ void Folder::wipe() // Delete files that have been partially downloaded. slotDiscardDownloadProgress(); - //Unregister the socket API so it does not keep the .sync_journal file open + //Unregister the socket API so it does not keep the ._sync_journal file open FolderMan::instance()->socketApi()->slotUnregisterPath(alias()); _journal.close(); // close the sync journal diff --git a/src/gui/folderwatcher_linux.cpp b/src/gui/folderwatcher_linux.cpp index ed935888e..c8024c00b 100644 --- a/src/gui/folderwatcher_linux.cpp +++ b/src/gui/folderwatcher_linux.cpp @@ -169,7 +169,7 @@ void FolderWatcherPrivate::slotReceivedNotification(int fd) if (event->len > 0 && event->wd > -1) { QByteArray fileName(event->name); // qDebug() << Q_FUNC_INFO << event->name; - if (fileName.startsWith(".sync_") || + if (fileName.startsWith("._sync_") || fileName.startsWith(".csync_journal.db") || fileName.startsWith(".owncloudsync.log")) { // qDebug() << "ignore journal"; diff --git a/src/libsync/syncjournaldb.cpp b/src/libsync/syncjournaldb.cpp index 8193d40ad..1e7adbbb6 100644 --- a/src/libsync/syncjournaldb.cpp +++ b/src/libsync/syncjournaldb.cpp @@ -48,7 +48,7 @@ void SyncJournalDb::setAccountParameterForFilePath( const QString& localPath, co { // localPath always has a trailing slash _dbFile = localPath; - _dbFile.append( QLatin1String(".sync_")); + _dbFile.append( QLatin1String("._sync_")); // FIXME: Maybe it is better to only allow different hosts, without path component. QString remoteUrlPath = remoteUrl.toString(); if( remotePath != QLatin1String("/") ) { diff --git a/test/syncenginetestutils.h b/test/syncenginetestutils.h index 651c34f25..b68f84397 100644 --- a/test/syncenginetestutils.h +++ b/test/syncenginetestutils.h @@ -738,7 +738,7 @@ public: _account->setCredentials(new FakeCredentials{_fakeQnam}); _journalDb.reset(new OCC::SyncJournalDb()); - _journalDb->setDatabaseFilePath(localPath() + ".sync_test.db"); + _journalDb->setDatabaseFilePath(localPath() + "._sync_test.db"); _syncEngine.reset(new OCC::SyncEngine(_account, localPath(), "", _journalDb.get())); // A new folder will update the local file state database on first sync.