Repository navigation
Conversation
guettli
force-pushed
the
fix/directory-invalid-remote-mtime
branch
from
November 21, 2026 16:36
734fb2b to
f2ad508
Compare
A directory whose server-side mtime is invalid (0, e.g. a folder that
ended up with 1970-01-01 after being copied into the data directory)
was marked as an error during discovery ("Cannot sync due to invalid
modification time"). The whole directory and everything below it then
stayed unsynced, although a directory's mtime is only applied once,
when it is created locally.
Replace an invalid server mtime of a directory right where the server
entries are processed, before any comparison: the journal value, else
the local mtime, else the current time. The journal value comes first
because it is stable, so the directory is not seen as changed on every
sync. This keeps the journal invariant (modtime > 0) and leaves the
check for files unchanged.
Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Thomas Güttler <info@thomas-guettler.de>
guettli
force-pushed
the
fix/directory-invalid-remote-mtime
branch
from
November 22, 2026 11:04
f2ad508 to
b28e791
Compare
guettli
marked this pull request as ready for review
November 22, 2026 16:01
guettli
requested review from
camilasan,
claucambra,
i2h3,
mgallien and
nilsding
as code owners
November 22, 2026 16:01
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.
Resolves
Summary
A directory with an invalid mtime on the server (0 / 1970-01-01) was marked as
an error during discovery ("Cannot sync due to invalid modification time"), so
the directory and everything below it never synced. I hit this with a music
library copied into a user's data directory with
rsync -a: one folder hadmtime 0, and its 101 files were blocked.
A directory's mtime is only applied once, when the directory is created
locally, so it should not block the sync. Directories now get a valid
fallback (the journal's, else the local mtime, else now). The check for files
is unchanged, and the journal keeps its
modtime > 0invariant.How to verify: on the server,
touch -d @0a folder with files in it andrun
occ files:scan; the client syncs it instead of reporting the error.End-to-end check (run with Claude Code): nextcloudcmd built from this branch
against a fresh Nextcloud 35.0.3 server, a folder with files touched to mtime 0
and rescanned. Without the fix the folder fails with "Cannot sync due to
invalid modification time" and only the other folder syncs; with the fix
everything syncs, and the substituted mtime stays the same on the next sync.
New tests
TestSyncEngine::testDirectoryInvalidRemoteMtimeandTestSyncVirtualFiles::testDirectoryInvalidRemoteMtime:fakeFolder.syncOnce()returned FALSE)LocalDiscoveryTest all pass (CI image client-sid-6.10.2-4)
Checklist
AI (if applicable)
The fix and test were written with Claude Code; I reviewed and verified them.