From 3b7b62df1a1ce8b85fc78f1b9bb644542e606206 Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Mon, 20 Nov 2023 12:17:35 +0100 Subject: [PATCH] extend log to get information about mtime modifications by the client Signed-off-by: Matthieu Gallien --- src/gui/folderwatcher.cpp | 1 + src/libsync/owncloudpropagator.cpp | 1 + src/libsync/propagatedownload.cpp | 2 ++ src/libsync/vfs/cfapi/cfapiwrapper.cpp | 1 + src/libsync/vfs/suffix/vfs_suffix.cpp | 2 ++ src/libsync/vfs/xattr/vfs_xattr.cpp | 2 ++ 6 files changed, 9 insertions(+) diff --git a/src/gui/folderwatcher.cpp b/src/gui/folderwatcher.cpp index c08d54472983..07436463a81a 100644 --- a/src/gui/folderwatcher.cpp +++ b/src/gui/folderwatcher.cpp @@ -146,6 +146,7 @@ void FolderWatcher::startNotificationTestWhenReady() auto path = _testNotificationPath; if (QFile::exists(path)) { auto mtime = FileSystem::getModTime(path); + qCDebug(lcFolderWatcher()) << "setModTime" << path << (mtime + 1); FileSystem::setModTime(path, mtime + 1); } else { QFile f(path); diff --git a/src/libsync/owncloudpropagator.cpp b/src/libsync/owncloudpropagator.cpp index b2a058088c30..4745b4f846fb 100644 --- a/src/libsync/owncloudpropagator.cpp +++ b/src/libsync/owncloudpropagator.cpp @@ -1378,6 +1378,7 @@ void PropagateDirectory::slotSubJobsFinished(SyncFileItem::Status status) qCWarning(lcDirectory) << "Error writing to the database for file" << _item->_file; } + qCDebug(lcPropagator()) << "setModTime" << propagator()->fullLocalPath(_item->destination()) << _item->_modtime; FileSystem::setModTime(propagator()->fullLocalPath(_item->destination()), _item->_modtime); } diff --git a/src/libsync/propagatedownload.cpp b/src/libsync/propagatedownload.cpp index cdc4d17e97ab..6d7d5e2ebee0 100644 --- a/src/libsync/propagatedownload.cpp +++ b/src/libsync/propagatedownload.cpp @@ -606,6 +606,7 @@ void PropagateDownloadFile::conflictChecksumComputed(const QByteArray &checksumT } if (_item->_modtime != _item->_previousModtime) { Q_ASSERT(_item->_modtime > 0); + qCDebug(lcPropagateDownload()) << "setModTime" << fn << _item->_modtime; FileSystem::setModTime(fn, _item->_modtime); emit propagator()->touchedFile(fn); } @@ -1162,6 +1163,7 @@ void PropagateDownloadFile::downloadFinished() if (_item->_modtime <= 0) { qCWarning(lcPropagateDownload()) << "invalid modified time" << _item->_file << _item->_modtime; } + qCDebug(lcPropagateDownload()) << "setModTime" << _tmpFile.fileName() << _item->_modtime; FileSystem::setModTime(_tmpFile.fileName(), _item->_modtime); // We need to fetch the time again because some file systems such as FAT have worse than a second // Accuracy, and we really need the time from the file system. (#3103) diff --git a/src/libsync/vfs/cfapi/cfapiwrapper.cpp b/src/libsync/vfs/cfapi/cfapiwrapper.cpp index bd445042dcae..12c4f740238a 100644 --- a/src/libsync/vfs/cfapi/cfapiwrapper.cpp +++ b/src/libsync/vfs/cfapi/cfapiwrapper.cpp @@ -779,6 +779,7 @@ OCC::Result OCC::CfApiWrapper::createPlaceholderInfo(const QStrin cloudEntry.FsMetadata.FileSize.QuadPart = 0; } + qCDebug(lcCfApiWrapper) << "CfCreatePlaceholders" << path << modtime; const qint64 result = CfCreatePlaceholders(localBasePath.data(), &cloudEntry, 1, CF_CREATE_FLAG_NONE, nullptr); if (result != S_OK) { qCWarning(lcCfApiWrapper) << "Couldn't create placeholder info for" << path << ":" << QString::fromWCharArray(_com_error(result).ErrorMessage()); diff --git a/src/libsync/vfs/suffix/vfs_suffix.cpp b/src/libsync/vfs/suffix/vfs_suffix.cpp index f4d5e9a05d72..d82422787e27 100644 --- a/src/libsync/vfs/suffix/vfs_suffix.cpp +++ b/src/libsync/vfs/suffix/vfs_suffix.cpp @@ -80,6 +80,7 @@ Result VfsSuffix::updateMetadata(const QString &filePath, time_t return {tr("Error updating metadata due to invalid modification time")}; } + qCDebug(lcVfsSuffix()) << "setModTime" << filePath << modtime; FileSystem::setModTime(filePath, modtime); return {}; } @@ -108,6 +109,7 @@ Result VfsSuffix::createPlaceholder(const SyncFileItem &item) file.write(" "); file.close(); + qCDebug(lcVfsSuffix()) << "setModTime" << fn << item._modtime; FileSystem::setModTime(fn, item._modtime); return {}; } diff --git a/src/libsync/vfs/xattr/vfs_xattr.cpp b/src/libsync/vfs/xattr/vfs_xattr.cpp index f6ba09f1e365..cf553eb37c5f 100644 --- a/src/libsync/vfs/xattr/vfs_xattr.cpp +++ b/src/libsync/vfs/xattr/vfs_xattr.cpp @@ -75,6 +75,7 @@ Result VfsXAttr::updateMetadata(const QString &filePath, time_t m return {tr("Error updating metadata due to invalid modification time")}; } + qCDebug(lcVfsXAttr()) << "setModTime" << filePath << modtime; FileSystem::setModTime(filePath, modtime); return {}; } @@ -98,6 +99,7 @@ Result VfsXAttr::createPlaceholder(const SyncFileItem &item) file.write(" "); file.close(); + qCDebug(lcVfsXAttr()) << "setModTime" << path << item._modtime; FileSystem::setModTime(path, item._modtime); return xattr::addNextcloudPlaceholderAttributes(path); }