diff --git a/csync/src/csync.c b/csync/src/csync.c index 65a0655afc..5f720797c3 100644 --- a/csync/src/csync.c +++ b/csync/src/csync.c @@ -386,6 +386,20 @@ static int _csync_treewalk_visitor(void *obj, void *data) { SAFE_FREE(renamed_path); } + if (!other_node) { + /* Check the source path as well. */ + int len; + uint64_t h = 0; + char *renamed_path = csync_rename_adjust_path_source(ctx, cur->path); + + if (!c_streq(renamed_path, cur->path)) { + len = strlen( renamed_path ); + h = c_jhash64((uint8_t *) renamed_path, len, 0); + other_node = c_rbtree_find(other_tree, &h); + } + SAFE_FREE(renamed_path); + } + if (obj == NULL || data == NULL) { ctx->status_code = CSYNC_STATUS_PARAM_ERROR; return -1; diff --git a/csync/src/csync_rename.cc b/csync/src/csync_rename.cc index 64da49aa73..f7c77a4ea2 100644 --- a/csync/src/csync_rename.cc +++ b/csync/src/csync_rename.cc @@ -43,6 +43,7 @@ struct csync_rename_s { } std::map folder_renamed_to; // map from->to + std::map folder_renamed_from; // map to->from struct renameop { csync_file_stat_t *st; @@ -63,6 +64,7 @@ void csync_rename_destroy(CSYNC* ctx) void csync_rename_record(CSYNC* ctx, const char* from, const char* to) { csync_rename_s::get(ctx)->folder_renamed_to[from] = to; + csync_rename_s::get(ctx)->folder_renamed_from[to] = from; } char* csync_rename_adjust_path(CSYNC* ctx, const char* path) @@ -78,4 +80,18 @@ char* csync_rename_adjust_path(CSYNC* ctx, const char* path) return c_strdup(path); } +char* csync_rename_adjust_path_source(CSYNC* ctx, const char* path) +{ + csync_rename_s* d = csync_rename_s::get(ctx); + for (std::string p = _parentDir(path); !p.empty(); p = _parentDir(p)) { + std::map< std::string, std::string >::iterator it = d->folder_renamed_from.find(p); + if (it != d->folder_renamed_from.end()) { + std::string rep = it->second + (path + p.length()); + return c_strdup(rep.c_str()); + } + } + return c_strdup(path); +} + + } diff --git a/csync/src/csync_rename.h b/csync/src/csync_rename.h index 75247696c2..a4f50a0ac5 100644 --- a/csync/src/csync_rename.h +++ b/csync/src/csync_rename.h @@ -26,7 +26,10 @@ extern "C" { #endif +/* Return the final destination path of a given patch in case of renames */ char *csync_rename_adjust_path(CSYNC *ctx, const char *path); +/* Return the source of a given path in case of renames */ +char *csync_rename_adjust_path_source(CSYNC *ctx, const char *path); void csync_rename_destroy(CSYNC *ctx); void csync_rename_record(CSYNC *ctx, const char *from, const char *to); diff --git a/csync/tests/ownCloud/ownCloud/Test.pm b/csync/tests/ownCloud/ownCloud/Test.pm index a4fb6bdff7..6e755b054c 100644 --- a/csync/tests/ownCloud/ownCloud/Test.pm +++ b/csync/tests/ownCloud/ownCloud/Test.pm @@ -124,7 +124,8 @@ sub initTesting(;$) $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0 } - $d = HTTP::DAV->new(); + my $ua = HTTP::DAV::UserAgent->new(keep_alive => 1 ); + $d = HTTP::DAV->new(-useragent => $ua); $d->credentials( -url=> $owncloud, -realm=>"ownCloud", -user=> $user, diff --git a/src/gui/application.cpp b/src/gui/application.cpp index c970e9cf1c..1295cee039 100644 --- a/src/gui/application.cpp +++ b/src/gui/application.cpp @@ -110,9 +110,9 @@ Application::Application(int &argc, char **argv) : if (isRunning()) return; -#if QT_VERSION > QT_VERSION_CHECK(5, 0, 0) +#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0) && QT_VERSION < QT_VERSION_CHECK(5, 4, 2) // Workaround for QTBUG-44576: Make sure a stale QSettings lock file - // is deleted. + // is deleted. (Introduced in Qt 5.4.0 and fixed in Qt 5.4.2) { QString lockFilePath = ConfigFile().configFile() + QLatin1String(".lock"); QLockFile(lockFilePath).removeStaleLockFile(); diff --git a/src/libsync/bandwidthmanager.cpp b/src/libsync/bandwidthmanager.cpp index 3a10b0d732..ae48aed219 100644 --- a/src/libsync/bandwidthmanager.cpp +++ b/src/libsync/bandwidthmanager.cpp @@ -184,7 +184,7 @@ void BandwidthManager::relativeUploadMeasuringTimerExpired() // qDebug() << Q_FUNC_INFO << _relativeUploadLimitProgressAtMeasuringRestart // << relativeLimitProgressMeasured << relativeLimitProgressDifference; - qint64 speedkBPerSec = (relativeLimitProgressDifference / relativeLimitMeasuringTimerIntervalMsec*1000.0) / 1024.0; +// qint64 speedkBPerSec = (relativeLimitProgressDifference / relativeLimitMeasuringTimerIntervalMsec*1000.0) / 1024.0; // qDebug() << Q_FUNC_INFO << relativeLimitProgressDifference/1024 <<"kB =>" << speedkBPerSec << "kB/sec on full speed (" // << _relativeLimitCurrentMeasuredDevice->_readWithProgress << _relativeLimitCurrentMeasuredDevice->_read // << qAbs(_relativeLimitCurrentMeasuredDevice->_readWithProgress @@ -277,7 +277,7 @@ void BandwidthManager::relativeDownloadMeasuringTimerExpired() qDebug() << Q_FUNC_INFO << _relativeDownloadLimitProgressAtMeasuringRestart << relativeLimitProgressMeasured << relativeLimitProgressDifference; - qint64 speedkBPerSec = (relativeLimitProgressDifference / relativeLimitMeasuringTimerIntervalMsec*1000.0) / 1024.0; +// qint64 speedkBPerSec = (relativeLimitProgressDifference / relativeLimitMeasuringTimerIntervalMsec*1000.0) / 1024.0; // qDebug() << Q_FUNC_INFO << relativeLimitProgressDifference/1024 <<"kB =>" << speedkBPerSec << "kB/sec on full speed (" // << _relativeLimitCurrentMeasuredJob->currentDownloadPosition() ; diff --git a/src/libsync/propagatedownload.cpp b/src/libsync/propagatedownload.cpp index 6962867e41..d0286243ae 100644 --- a/src/libsync/propagatedownload.cpp +++ b/src/libsync/propagatedownload.cpp @@ -532,6 +532,7 @@ void PropagateDownloadFileQNAM::downloadFinished() done(SyncFileItem::SoftError, renameError); return; } + qDebug() << "Created conflict file" << fn << "->" << conflictFileName; } FileSystem::setModTime(_tmpFile.fileName(), _item->_modtime); diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp index 3ff29b053d..a9f34c8351 100644 --- a/src/libsync/syncengine.cpp +++ b/src/libsync/syncengine.cpp @@ -604,13 +604,14 @@ void SyncEngine::startSync() bool isUpdateFrom_1_8 = _journal->isUpdateFrom_1_8_0(); /* - * If 1.8.0 caused missing data in the local tree, this patch gets it - * back. For that, the usage of the journal for remote repository is - * disabled at the first start. + * If we are upgrading from a client version older than 1.5 is found, + * we cannot read from the database because we need to fetch the files id and etags. + * + * If 1.8.0 caused missing data in the local tree, so we also don't read from DB + * to get back the files that were gone. */ if (fileRecordCount >= 1 && (isUpdateFrom_1_5 || isUpdateFrom_1_8)) { - qDebug() << "detected update from 1.5" << fileRecordCount << isUpdateFrom_1_5; - // Disable the read from DB to be sure to re-read all the fileid and etags. + qDebug() << "detected update from 1.5 or 1.8" << fileRecordCount << isUpdateFrom_1_5; _csync_ctx->read_remote_from_db = false; } else { _csync_ctx->read_remote_from_db = true; diff --git a/test/testxmlparse.h b/test/testxmlparse.h index 0b667eb507..167cb159a1 100644 --- a/test/testxmlparse.h +++ b/test/testxmlparse.h @@ -431,14 +431,14 @@ private slots: this, SLOT(slotFinishedSuccessfully()) ); QHash sizes; - QVERIFY(parser.parse( testXml, &sizes, "/ä" )); + QVERIFY(parser.parse( testXml, &sizes, QString::fromUtf8("/ä") )); QVERIFY(_success); - QVERIFY(_items.contains("/ä/ä.pdf")); - QVERIFY(_items.contains("/ä")); + QVERIFY(_items.contains(QString::fromUtf8("/ä/ä.pdf"))); + QVERIFY(_items.contains(QString::fromUtf8("/ä"))); QVERIFY(_items.size() == 2 ); - QVERIFY(_subdirs.contains("/ä")); + QVERIFY(_subdirs.contains(QString::fromUtf8("/ä"))); QVERIFY(_subdirs.size() == 1); }