Skip to content

Commit

Permalink
extend log to get information about mtime modifications by the client
Browse files Browse the repository at this point in the history
Signed-off-by: Matthieu Gallien <[email protected]>
  • Loading branch information
mgallien authored and backportbot-nextcloud[bot] committed Dec 6, 2023
1 parent 7dd9499 commit 3b7b62d
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/gui/folderwatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/libsync/owncloudpropagator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 2 additions & 0 deletions src/libsync/propagatedownload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions src/libsync/vfs/cfapi/cfapiwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,7 @@ OCC::Result<void, QString> 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());
Expand Down
2 changes: 2 additions & 0 deletions src/libsync/vfs/suffix/vfs_suffix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ Result<void, QString> 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 {};
}
Expand Down Expand Up @@ -108,6 +109,7 @@ Result<void, QString> VfsSuffix::createPlaceholder(const SyncFileItem &item)

file.write(" ");
file.close();
qCDebug(lcVfsSuffix()) << "setModTime" << fn << item._modtime;
FileSystem::setModTime(fn, item._modtime);
return {};
}
Expand Down
2 changes: 2 additions & 0 deletions src/libsync/vfs/xattr/vfs_xattr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ Result<void, QString> 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 {};
}
Expand All @@ -98,6 +99,7 @@ Result<void, QString> VfsXAttr::createPlaceholder(const SyncFileItem &item)

file.write(" ");
file.close();
qCDebug(lcVfsXAttr()) << "setModTime" << path << item._modtime;
FileSystem::setModTime(path, item._modtime);
return xattr::addNextcloudPlaceholderAttributes(path);
}
Expand Down

0 comments on commit 3b7b62d

Please sign in to comment.