fix: stop forcing size-only sync comparisons via RCLONE_LOCAL_NO_SET_MODTIME#410
Open
7MS8 wants to merge 1 commit into
Open
fix: stop forcing size-only sync comparisons via RCLONE_LOCAL_NO_SET_MODTIME#4107MS8 wants to merge 1 commit into
7MS8 wants to merge 1 commit into
Conversation
…MODTIME RCLONE_LOCAL_NO_SET_MODTIME=true has been set for every rclone invocation since 2021 (f43949b) to avoid chtimes crashes on old Android storage stacks (rclone#2446). It has a much bigger side effect than intended: rclone's local backend Precision() reports fs.ModTimeNotSupported unconditionally whenever NoSetModTime is set (backend/local/local.go), and rclone's default file comparison treats ModTimeNotSupported as "always equal" as soon as sizes match (fs/operations/operations.go) -- skipping modification-time comparison entirely. Every sync, regardless of remote type or --checksum, silently degraded to a same-size-means-unchanged check. Changed files that happened to keep the same size were never re-synced. Verified in current rclone (v1.71.0, vendored in this repo) that a failing chtimes()/SetModTime is not fatal: fs/operations/operations.go just logs and counts the error, the transfer itself still succeeds. The 2021 workaround is no longer needed and was silently breaking change detection instead. Verified against a live Synology SFTP remote: a same-size, content-changed file is now correctly detected via modtime and re-transferred ("Copied (replaced existing)"), a second sync correctly no-ops once the file is genuinely in sync, and the local destination's mtime is now correctly set to match the source with no chtimes errors logged.
8 tasks
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.
Split out of #406 per reviewer request (separate unrelated fixes into their own PRs).
Bug
RCLONE_LOCAL_NO_SET_MODTIME=truehas been set for every rclone invocation since 2021 (f43949be), to work around chtimes crashes on old Android storage stacks (rclone#2446). It has a much bigger side effect than intended: rclone's local backendPrecision()reportsfs.ModTimeNotSupportedunconditionally wheneverNoSetModTimeis set (backend/local/local.go), and rclone's default file comparison treatsModTimeNotSupportedas "always equal" as soon as file sizes match (fs/operations/operations.go) — modification-time comparison is skipped entirely. Every sync, regardless of remote type or--checksum, silently degrades to a same-size-means-unchanged check. Changed files that happen to keep the same size are never re-synced.Fix
Verified in current rclone (v1.71.0, vendored in this repo) that a failing
chtimes()/SetModTimeis not fatal:fs/operations/operations.gojust logs and counts the error, the transfer itself still succeeds. The 2021 workaround for the old crash is no longer needed and was silently breaking change detection instead. RemoveRCLONE_LOCAL_NO_SET_MODTIME=truefrom bothRclone.javaandRcloneRcd.java, letting rclone's own runtime precision probe handle it per-remote.Reproduction
sync.logshows the file is skipped ("Sizes identical" / unchanged) — the change is never picked up.Test plan
chtimeserrors logged, local mtime ends up matching the source../gradlew :app:compileOssDebugSources).