[stable-4.0] fix(filesystem): do not attempt to lock directories on Windows - #10509
Open
backportbot[bot] wants to merge 1 commit into
Open
[stable-4.0] fix(filesystem): do not attempt to lock directories on Windows#10509backportbot[bot] wants to merge 1 commit into
backportbot[bot] wants to merge 1 commit into
Conversation
claucambra
approved these changes
Jul 31, 2026
LockFile() locks a byte range within a file and is not supported for directory handles, where it always fails with ERROR_INVALID_PARAMETER. FILE_FLAG_BACKUP_SEMANTICS lets CreateFileW() open directories, so isFileLocked() reached that failing call for every directory and logged a warning for each one. Discovery checks every entry, directories included, so a sync run logged one bogus warning per directory. On large folder trees those warnings dominate the log volume, and the resulting log rotation discards the records needed to diagnose actual problems. Return the opened handle for directories instead of attempting the lock. CreateFileW() still runs, so a directory held with deny-sharing is still reported as locked; only the attempt that cannot succeed is gone. Measured on a synced folder with 82464 directories, same build and configuration: a full discovery run logged 83189 of these warnings without this change and none with it. The added test covers both halves and fails without the fix. Test suite green on Windows (70 tests). For #10444 Assisted-by: Claude Code:claude-opus-5 Signed-off-by: Andreas Bohl <ab@eeloy.com>
nilsding
force-pushed
the
backport/10487/stable-4.0
branch
from
July 31, 2026 08:19
64bfba6 to
fe62aef
Compare
nilsding
approved these changes
Jul 31, 2026
Contributor
|
Artifact containing the AppImage: nextcloud-appimage-pr-10509.zip Digest: To test this change/fix you can download the above artifact file, unzip it, and run it. Please make sure to quit your existing Nextcloud app and backup your data. |
Contributor
|
Artifact containing the AppImage: nextcloud-appimage-pr-10509.zip Digest: To test this change/fix you can download the above artifact file, unzip it, and run it. Please make sure to quit your existing Nextcloud app and backup your data. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of PR #10487