mirror of
https://github.com/rclone/rclone.git
synced 2026-09-23 14:25:46 -04:00
Layers which wrap backends, such as the hasher backend and the VFS cache, use fs.Fingerprint to detect whether an object has changed. This only works if the object a backend hands back from a write operation is identical to the object a fresh listing returns. If a backend keeps the source's nanosecond precision modtime in memory while the server stores milliseconds, or omits a hash the server knows, every fingerprint comparison fails and cached hashes or files are silently invalidated. The existing tests compared modtimes within f.Precision() so they could not detect these sub-precision divergences. Add a checkFingerprint helper which asserts the fast and slow fs.Fingerprint of the object returned from a write operation exactly match those of the object read back from the remote, and wire it into all the write paths which return or mutate an object: Put (all variants), PutStream, large and streamed uploads, Update, SetModTime, server side Copy and Move, and the metadata mutating Copy/Move subtests. Rework the ObjectOpenFingerprint test to use the same helper against a fully read reference object, with subtests reporting which kind of read is being checked.