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 committed Nov 20, 2023
1 parent ad15eb0 commit 7138292
Show file tree
Hide file tree
Showing 6 changed files with 10 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);
qCInfo(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;
}

qCInfo(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);
qCInfo(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;
}
qCInfo(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
2 changes: 2 additions & 0 deletions src/libsync/vfs/cfapi/cfapiwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,7 @@ OCC::Result<void, QString> OCC::CfApiWrapper::createPlaceholderInfo(const QStrin
cloudEntry.FsMetadata.FileSize.QuadPart = 0;
}

qCInfo(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 Expand Up @@ -773,6 +774,7 @@ OCC::Result<OCC::Vfs::ConvertToPlaceholderResult, QString> OCC::CfApiWrapper::up
OCC::Utility::UnixTimeToLargeIntegerFiletime(modtime, &metadata.BasicInfo.ChangeTime);
metadata.BasicInfo.FileAttributes = 0;

qCInfo(lcCfApiWrapper) << "CfUpdatePlaceholder" << path << modtime;
const qint64 result = CfUpdatePlaceholder(handleForPath(path).get(), &metadata,
fileIdentity.data(), sizeToDWORD(fileIdentitySize),
nullptr, 0, CF_UPDATE_FLAG_MARK_IN_SYNC, nullptr, nullptr);
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")};
}

qCInfo(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();
qCInfo(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")};
}

qCInfo(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();
qCInfo(lcVfsXAttr()) << "setModTime" << path << item._modtime;
FileSystem::setModTime(path, item._modtime);
return xattr::addNextcloudPlaceholderAttributes(path);
}
Expand Down

0 comments on commit 7138292

Please sign in to comment.