rsync 3.5.1: read the protocol 33 block stat, and stop truncating byte totals - #45
Merged
Merged
Conversation
…e totals
rsync 3.5.1 bumped the protocol to 33 and added a line to --stats:
Number of 4 KiB logical blocks touched: 857
printed between "Literal data" and "Matched data", and only when both ends
negotiate 33. Nothing gated 3.5.1 out before this -- every capability check is
a lower bound and the parser drops lines it does not recognise -- but the new
number fell through to the log instead of being read.
Parse it into RsyncStats.logicalBlocksTouched, gate it on a new blockStats
capability taken from the negotiated protocol rather than the version string,
and intersect it like the rest so a mixed 3.5/3.4 pair reports null instead of
a number only one end can produce. The CLI prints the line when it is there and
stays silent when it is not.
Verifying that against a real 3.5.1 build turned up a separate bug. rsync
prints byte totals with human_num, so under --human-readable -- which DiskPush
passes by default -- "Total bytes sent: 3.50M" was being read by a [\d,]+
pattern as 3. Literal data, matched data, both byte totals and speedup were all
wrong on every version, not just 3.5.1. Byte fields now read the unit suffix
back through the same conversion the progress line already used; counts keep
their exact comma_num parsing.
Checked against real binaries on both sides: stock 3.4.1 and a 3.5.1 built from
source. The full live suite passes against each, including the resume test that
exercises the partial-dir validation 3.5.1 tightened.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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
rsync 3.5.1 shipped 2026-09-21 with protocol 33, which adds one line to
--stats:printed between
Literal dataandMatched data, and only when both ends negotiate 33.DiskPush already ran fine on 3.5.1 — every capability check is a lower bound, and the parser passes lines it does not recognise through to the log — but that number was being dropped on the floor. This reads it, and covers both the version distros ship today (3.4.x) and the latest.
RsyncStats.logicalBlocksTouched, parsed from the real label, verbatim from rsync'smain.c.blockStatscapability taken from the negotiated protocol rather than the version string, falling back to the version only for a banner that prints no protocol line.nullrather than a number only one end can produce.Blocks touched: 856 x 4 KiBwhen it is available and stays silent when it is not.statsis now in the--jsonpayload.The bug this turned up
Verifying against a real 3.5.1 build exposed something unrelated to 3.5.1 and older than it. rsync prints byte totals with
human_num, so under--human-readable— which DiskPush passes by default — the output isTotal bytes sent: 3.50M. The stats patterns only read[\d,]+, so that parsed as 3.Every byte field was affected on every rsync version:
totalBytesSentliteralBytesspeedupByte fields now read the unit suffix back through the same conversion the progress line already used. Counts keep their exact
comma_numparsing, so the new block stat is unaffected either way.I fixed this rather than only reporting it because this PR puts
statsinto the--jsonoutput, and publishing knowingly wrong numbers in a new contract seemed worse than the extra diff. Happy to split it out if you would rather.Verification
Not just unit tests — built rsync 3.5.1 from source and ran both binaries for real.
Parsed from genuine
--statsoutput:--partial-dirresume is unaffected.Note for a follow-up
3.5.1 also changed
--files-frompaths to be treated as operator-supplied rather than transfer-root-relative. DiskPush passes--files-fromstraight through, so the semantic shift is upstream's, but it could change path resolution for anyone using that flag on 3.5.1. Not addressed here.🤖 Generated with Claude Code