Skip to content

fix: add zlib deflateSetDictionary sync after each block match - #2523

Merged
oferchen merged 1 commit into
masterfrom
fix/zlib-dictionary-sync
Feb 27, 2026
Merged

oferchen merged 1 commit into
masterfrom
fix/zlib-dictionary-sync

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

  • Add zlib dictionary synchronization in write_delta_with_compression after each block match token, matching upstream rsync's send_deflated_token() behavior (token.c lines 460-484)
  • Re-read matched block data from the source file and feed it through encoder.see_token() for CPRES_ZLIB mode
  • Set is_zlibx flag on encoder for ZlibX mode (dictionary sync is a no-op)
  • Fix pre-existing clippy large_enum_variant warning on TokenReader

Test plan

  • New tests verify dictionary sync across multiple blocks
  • New tests verify dictionary sync across file boundaries
  • New tests verify ZlibX mode skips dictionary sync
  • All 5419 existing protocol and transfer tests pass
  • cargo clippy passes with zero warnings

@github-actions github-actions Bot added the bug Something isn't working label Feb 27, 2026
@oferchen
oferchen force-pushed the fix/zlib-dictionary-sync branch 3 times, most recently from cc61ad9 to 6d61948 Compare February 27, 2026 10:20
In CPRES_ZLIB mode, feed matched block data through the compressor
dictionary after each block match token so the deflate stream stays
synchronized between sender and receiver. Without this, subsequent
literal data may reference dictionary entries the other side hasn't
seen, causing decompression failures.

Upstream reference: token.c:send_deflated_token() lines 460-484.
@oferchen
oferchen force-pushed the fix/zlib-dictionary-sync branch from 6d61948 to 9278f1f Compare February 27, 2026 10:49
@oferchen
oferchen merged commit 8940fcf into master Feb 27, 2026
9 checks passed
@oferchen
oferchen deleted the fix/zlib-dictionary-sync branch February 27, 2026 11:17
oferchen added a commit that referenced this pull request May 1, 2026
In CPRES_ZLIB mode, feed matched block data through the compressor
dictionary after each block match token so the deflate stream stays
synchronized between sender and receiver. Without this, subsequent
literal data may reference dictionary entries the other side hasn't
seen, causing decompression failures.

Upstream reference: token.c:send_deflated_token() lines 460-484.
oferchen added a commit that referenced this pull request May 5, 2026
In CPRES_ZLIB mode, feed matched block data through the compressor
dictionary after each block match token so the deflate stream stays
synchronized between sender and receiver. Without this, subsequent
literal data may reference dictionary entries the other side hasn't
seen, causing decompression failures.

Upstream reference: token.c:send_deflated_token() lines 460-484.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant