Skip to content

[stable-34.0] fix(filesystem): do not attempt to lock directories on Windows - #10504

Merged
nilsding merged 1 commit into
stable-34.0from
backport/10487/stable-34.0
Jul 31, 2026
Merged

[stable-34.0] fix(filesystem): do not attempt to lock directories on Windows#10504
nilsding merged 1 commit into
stable-34.0from
backport/10487/stable-34.0

Conversation

@backportbot

@backportbot backportbot Bot commented Jul 31, 2026

Copy link
Copy Markdown

Backport of PR #10487

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>
@backportbot
backportbot Bot requested a review from camilasan July 31, 2026 08:07
@backportbot
backportbot Bot requested a review from claucambra July 31, 2026 08:07
@backportbot backportbot Bot added this to the 34.0.1 milestone Jul 31, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Artifact containing the AppImage: nextcloud-appimage-pr-10504.zip

Digest: sha256:c119c0e38131629d3b36030e026c9c085c61a61e19c9475bb11fdcccfb7bf907

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.

@nilsding
nilsding enabled auto-merge July 31, 2026 08:14
@nilsding
nilsding merged commit 961209d into stable-34.0 Jul 31, 2026
19 checks passed
@nilsding
nilsding deleted the backport/10487/stable-34.0 branch July 31, 2026 08:50
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants