Repository navigation
operations: check checksums in rcat with known size - fixes #6305 - #9751
Merged
Merged
Conversation
RcatSize streams the body straight into Put behind an ObjectInfo with no hashes, so a known-size upload had its size checked but its checksum never verified, unlike the unknown-size path through Rcat which hashes as it goes. The stream can only be read once, so hash it on the way past and compare with the destination after the upload, as operations.Copy does. A destination which reports no usable hash is still checked by size, and one which fails either check has the failed copy removed.
ncw
approved these changes
Aug 13, 2026
ncw
left a comment
Member
There was a problem hiding this comment.
Thank you. This looks great. Will merge now :-)
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.
What does this change do?
RcatSize— used byrclone rcat --size, theoperations/uploadfilerc command and the serve backends — streamed a known-size upload straight intoPutbehind anObjectInfocarrying no hashes, so the upload's checksum was never verified. The unknown-size path throughRcatalready hashes as it goes, and the size has been checked since #9722, but the checksum for a known-size upload was not.This hashes the stream on the way past with an
io.TeeReader(it can only be read once) and compares it against the destination after the upload, alongside the existing size check, matching whatoperations.Copydoes. A destination that reports no usable hash is still checked by size,--ignore-checksumis respected, and an upload that fails either check has the corrupt copy removed.Linked issue
Fixes #6305