Skip to content

feat: implement xattr abbreviation wire format for -X/--xattrs interop - #3117

Merged
oferchen merged 2 commits into
masterfrom
feat/xattr-wire-format
Apr 6, 2026
Merged

oferchen merged 2 commits into
masterfrom
feat/xattr-wire-format

Conversation

@oferchen

@oferchen oferchen commented Apr 6, 2026

Copy link
Copy Markdown
Owner

Summary

  • Implement receiver-side xattr abbreviation protocol matching upstream rsync's receive_xattr() in xattrs.c
  • For xattr values exceeding MAX_FULL_DATUM (32 bytes), sender transmits only a checksum; receiver requests full values via delta-encoded 1-based entry numbers
  • Add ITEM_REPORT_XATTR and ITEM_LOCAL_CHANGE flag handling to SenderAttrs
  • Wire preserve_xattrs and want_xattr_optim through RequestConfig to both pipelined and non-pipelined transfer paths
  • Respect CF_AVOID_XATTR_OPTIM compatibility flag for local-change hardlink optimization

Upstream Reference

  • xattrs.c:receive_xattr() - abbreviation protocol
  • xattrs.c:send_xattr_request() / receive_xattr_request() - full value exchange
  • rsync.h:MAX_FULL_DATUM (32) - threshold for abbreviation

Test plan

  • CI passes: fmt + clippy, nextest all platforms
  • Xattr interop test: upstream push with --xattrs to oc-rsync daemon
  • Xattr interop test: oc-rsync push with --xattrs to upstream daemon
  • Verify wire format matches upstream via tcpdump comparison

Implement the receiver-side xattr abbreviation protocol matching upstream
rsync's receive_xattr() in xattrs.c. For xattr values exceeding
MAX_FULL_DATUM (32 bytes), the sender transmits only a checksum; the
receiver requests full values via delta-encoded 1-based entry numbers.

Key changes:
- Add read_with_codec_xattr() to SenderAttrs for ITEM_REPORT_XATTR parsing
- Add read_xattr_abbreviation_data() for delta-encoded (num, value) pairs
- Add write_xattr_request() for generator-side abbreviation requests
- Add apply_xattr_abbreviation_values() to update xattr cache with full data
- Wire preserve_xattrs and want_xattr_optim through RequestConfig
- Update both pipelined (streaming.rs) and non-pipelined (response.rs) paths
- Respect CF_AVOID_XATTR_OPTIM flag for local-change hardlink optimization
@github-actions github-actions Bot added the enhancement New feature or request label Apr 6, 2026
The protocol crate's varint module is private. Use the public
re-exports at the crate root (protocol::read_varint,
protocol::write_varint) instead of the private module path.
@oferchen
oferchen merged commit 5784654 into master Apr 6, 2026
37 checks passed
@oferchen
oferchen deleted the feat/xattr-wire-format branch April 6, 2026 06:13
oferchen added a commit that referenced this pull request May 1, 2026
#3117)

* feat: implement xattr abbreviation wire format for -X/--xattrs interop

Implement the receiver-side xattr abbreviation protocol matching upstream
rsync's receive_xattr() in xattrs.c. For xattr values exceeding
MAX_FULL_DATUM (32 bytes), the sender transmits only a checksum; the
receiver requests full values via delta-encoded 1-based entry numbers.

Key changes:
- Add read_with_codec_xattr() to SenderAttrs for ITEM_REPORT_XATTR parsing
- Add read_xattr_abbreviation_data() for delta-encoded (num, value) pairs
- Add write_xattr_request() for generator-side abbreviation requests
- Add apply_xattr_abbreviation_values() to update xattr cache with full data
- Wire preserve_xattrs and want_xattr_optim through RequestConfig
- Update both pipelined (streaming.rs) and non-pipelined (response.rs) paths
- Respect CF_AVOID_XATTR_OPTIM flag for local-change hardlink optimization

* fix: use public re-exports for varint functions

The protocol crate's varint module is private. Use the public
re-exports at the crate root (protocol::read_varint,
protocol::write_varint) instead of the private module path.
oferchen added a commit that referenced this pull request May 5, 2026
#3117)

* feat: implement xattr abbreviation wire format for -X/--xattrs interop

Implement the receiver-side xattr abbreviation protocol matching upstream
rsync's receive_xattr() in xattrs.c. For xattr values exceeding
MAX_FULL_DATUM (32 bytes), the sender transmits only a checksum; the
receiver requests full values via delta-encoded 1-based entry numbers.

Key changes:
- Add read_with_codec_xattr() to SenderAttrs for ITEM_REPORT_XATTR parsing
- Add read_xattr_abbreviation_data() for delta-encoded (num, value) pairs
- Add write_xattr_request() for generator-side abbreviation requests
- Add apply_xattr_abbreviation_values() to update xattr cache with full data
- Wire preserve_xattrs and want_xattr_optim through RequestConfig
- Update both pipelined (streaming.rs) and non-pipelined (response.rs) paths
- Respect CF_AVOID_XATTR_OPTIM flag for local-change hardlink optimization

* fix: use public re-exports for varint functions

The protocol crate's varint module is private. Use the public
re-exports at the crate root (protocol::read_varint,
protocol::write_varint) instead of the private module path.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant