Skip to content

fix: carry xattrs in local batches and drop unreadable-xattr entries - #8288

Merged
oferchen merged 8 commits into
masterfrom
fix/acl-xattr-read-errors
Nov 3, 2026
Merged

oferchen merged 8 commits into
masterfrom
fix/acl-xattr-read-errors

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Stacked on #8281. Retarget to master once that merges.

Summary

  • Local --write-batch -X now records xattrs the way 3.5.1 does. The batch is a tee of the sender's stream (io.c:2747 start_write_batch). Each entry's xattrs go in the file list. A value longer than MAX_FULL_DATUM (32 bytes) is stored there as a digest, and its full value follows the entry's iflags under ITEM_REPORT_XATTR (sender.c:482-484, xattrs.c:651-703 send_xattr_request). The value is marked to send when the destination lacks that name and datum (generator.c:571-582, xattr_diff). Before this change, local batches carried no xattrs.
  • --read-batch now applies those full values, on transfer rows and on metadata-only rows such as directories (xattrs.c:779-794 recv_xattr_request). Before this change, oc dropped long values even from batches 3.5.1 recorded.
  • The generator now reads xattrs for devices and specials only when -D keeps them, matching xattrs.c:322-345 get_xattr. The rule lives in one place, protocol::xattr::entry_carries_xattrs, used by the generator and the batch writer.
  • On the sender, an xattr read error drops the entry and sets IOERR_GENERAL, so the run exits 23 like flist.c:2050-2087 send_file_name. An ENOTSUP list means no names. Any other error prints upstream's text: get_xattr_names: llistxattr(<path>,1024) failed or get_xattr_data: lgetxattr(<path>,"<name>",0) failed.
  • The generator's ACL read keeps its documented mode-derived fallback. The doc on get_rsync_acl now points at the follow-up that moves the read into the create-and-send step (task 519).

Tests

  • tests/batch_upstream_oracle.rs local_batch_carries_xattrs_like_upstream: -rX and -rX --no-inc-recursive, with short and long values on files, nested files and a directory. oc and 3.5.1 each record a batch, both replay each one, and every result is compared to the source with getfattr. Gated on the xattr capability, setfattr and getfattr.
  • tests/sender_xattr_read_failure.rs (Linux, non-root): a mode-000 file has an xattr, so its value read fails with EACCES. oc and 3.5.1 clients pull it from an oc server. Expected: exit 23, the get_xattr_data line, the file dropped, its sibling copied.
  • Unit test protocol::xattr::scope::each_entry_type_follows_its_own_preserve_option.
  • Byte check: with --checksum-seed=1, oc's batch carrying long values is byte-identical to 3.5.1's in INC and no-inc modes, except the final stats trailer, which differs without -X too.
  • Mutations, 8 of 8 killed: no xattr list on the batch entry; no value block; long values never marked; replay ignores the value block (transfer row); replay ignores it on a directory row; devices and specials never carry xattrs; the generator swallows the read error; the walk prints the make_file text instead of upstream's.
  • Gates: fmt; clippy for Linux and windows-gnu; nextest protocol 6173, engine 4918, batch 227, transfer 3294, metadata 723, core 2941, cli 3896, daemon 2147, bin acl+batch+inc 89, all passed; interop oracle 664 cells, PASS 638, XFAIL 26, FAIL 0. All comparisons ran against the rsync 3.5.1 release tarball build.

Known limits

  • 3.5.1 cannot reliably replay a batch whose new directory carries xattrs, including its own batches: its forked receiver can act on the directory's ITEM_REPORT_XATTR row before its generator makes the directory, and fails stat ... failed (exit 23). The test replays directory-xattr batches through oc only.
  • Error text for a dot-dir operand names src/./b where upstream names src/b (tasks 99/100).
  • The generator's ACL read error still falls back to the mode-derived ACL instead of dropping the entry (task 519, after 488).
  • The local-copy engine and batch writer do not yet drop an entry on an ACL or xattr read failure (task 520).
  • ENODATA/ENOTSUP nuances for individual value reads follow get_xattr_data's message but are not exercised end to end.
  • Devices and specials are covered by the unit test only: a non-root runner can't create devices, and upstream's xattrs test has no such case.
  • The local batch stats trailer (total bytes) differs from 3.5.1 independently of this change (task 158).

@oferchen
oferchen force-pushed the fix/local-batch-acls branch from e60638d to aa6d2f8 Compare November 3, 2026 06:40
@oferchen
oferchen force-pushed the fix/acl-xattr-read-errors branch from f99305f to df53dc9 Compare November 3, 2026 07:16
@oferchen
oferchen changed the base branch from fix/local-batch-acls to master November 3, 2026 09:29
@github-actions github-actions Bot added the bug Something isn't working label Nov 3, 2026
@oferchen oferchen closed this Nov 3, 2026
@oferchen oferchen reopened this Nov 3, 2026
@oferchen
oferchen force-pushed the fix/acl-xattr-read-errors branch from df53dc9 to 2c3bb6f Compare November 3, 2026 19:42
@oferchen oferchen closed this Nov 3, 2026
@oferchen oferchen reopened this Nov 3, 2026
@oferchen
oferchen merged commit e7aede8 into master Nov 3, 2026
68 of 124 checks passed
@oferchen
oferchen deleted the fix/acl-xattr-read-errors branch November 3, 2026 21:19
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