From d1375281a214c3593008dd00f298870508ca4382 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Wed, 11 Sep 2024 14:18:15 +0800 Subject: [PATCH 1/2] Wrap all uses of FileSystem::setFolderPermissions in ifdefs for macOS Signed-off-by: Claudio Cambra --- src/libsync/discovery.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libsync/discovery.cpp b/src/libsync/discovery.cpp index a938088cc803a..efb221c150e3a 100644 --- a/src/libsync/discovery.cpp +++ b/src/libsync/discovery.cpp @@ -1832,9 +1832,11 @@ bool ProcessDirectoryJob::checkPermissions(const OCC::SyncFileItemPtr &item) item->_instruction = CSYNC_INSTRUCTION_ERROR; item->_errorString = tr("Not allowed because you don't have permission to add subfolders to that folder"); const auto localPath = QString{_discoveryData->_localDir + item->_file}; +#if !defined(Q_OS_MACOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_15 qCWarning(lcDisco) << "unexpected new folder in a read-only folder will be made read-write" << localPath; FileSystem::setFolderPermissions(localPath, FileSystem::FolderPermissions::ReadWrite); emit _discoveryData->remnantReadOnlyFolderDiscovered(item); +#endif return false; } else if (!item->isDirectory() && !perms.hasPermission(RemotePermissions::CanAddFile)) { qCWarning(lcDisco) << "checkForPermission: ERROR" << item->_file; @@ -2038,9 +2040,11 @@ int ProcessDirectoryJob::processSubJobs(int nbJobs) _dirItem->_instruction = CSYNC_INSTRUCTION_ERROR; _dirItem->_errorString = tr("Not allowed because you don't have permission to add subfolders to that folder"); const auto localPath = QString{_discoveryData->_localDir + _dirItem->_file}; +#if !defined(Q_OS_MACOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_15 qCWarning(lcDisco) << "unexpected new folder in a read-only folder will be made read-write" << localPath; FileSystem::setFolderPermissions(localPath, FileSystem::FolderPermissions::ReadWrite); emit _discoveryData->remnantReadOnlyFolderDiscovered(_dirItem); +#endif } _dirItem->_direction = _dirItem->_direction == SyncFileItem::Up ? SyncFileItem::Down : SyncFileItem::Up; From 45aa8df11a7c93bd05a73a37824b0f60be637a63 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Wed, 11 Sep 2024 14:21:25 +0800 Subject: [PATCH 2/2] Wrap use of folder permissions restore in mac ifdefs Signed-off-by: Claudio Cambra --- src/libsync/propagatorjobs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libsync/propagatorjobs.cpp b/src/libsync/propagatorjobs.cpp index 4bfe04da6c5d3..0a0a84e0d4934 100644 --- a/src/libsync/propagatorjobs.cpp +++ b/src/libsync/propagatorjobs.cpp @@ -377,9 +377,9 @@ void PropagateLocalRename::start() qCWarning(lcPropagateLocalRename) << "exception when checking parent folder access rights" << e.what() << e.path1().c_str() << e.path2().c_str(); } }; -#endif const auto folderPermissionsHandler = FileSystem::FilePermissionsRestore{existingFile, FileSystem::FolderPermissions::ReadWrite}; +#endif emit propagator()->touchedFile(existingFile); emit propagator()->touchedFile(targetFile);