Repository navigation
fix: read local ACL and xattrs once, before the delete pass - #8332
Merged
Merged
Conversation
oferchen
added a commit
that referenced
this pull request
Nov 4, 2026
4 of 5 tasks
oferchen
added a commit
that referenced
this pull request
Nov 4, 2026
oferchen
force-pushed
the
fix/local-acl-xattr-read-once
branch
from
November 4, 2026 08:55
d8a5e4c to
d42e743
Compare
oferchen
added a commit
that referenced
this pull request
Nov 4, 2026
oferchen
force-pushed
the
fix/local-acl-xattr-read-once
branch
from
November 4, 2026 13:01
d42e743 to
6f0d44a
Compare
oferchen
added a commit
that referenced
this pull request
Nov 4, 2026
oferchen
force-pushed
the
fix/local-acl-xattr-read-once
branch
from
November 4, 2026 15:08
6f0d44a to
99e3e2a
Compare
oferchen
added a commit
that referenced
this pull request
Nov 10, 2026
oferchen
force-pushed
the
fix/local-acl-xattr-read-once
branch
from
November 10, 2026 12:13
99e3e2a to
d3784fa
Compare
oferchen
added a commit
that referenced
this pull request
Nov 10, 2026
oferchen
force-pushed
the
fix/local-acl-xattr-read-once
branch
from
November 10, 2026 12:45
d3784fa to
24ae70d
Compare
oferchen
added a commit
that referenced
this pull request
Nov 10, 2026
oferchen
force-pushed
the
fix/local-acl-xattr-read-once
branch
from
November 10, 2026 14:13
24ae70d to
bda8fd1
Compare
oferchen
added a commit
that referenced
this pull request
Nov 10, 2026
oferchen
force-pushed
the
fix/local-acl-xattr-read-once
branch
from
November 10, 2026 17:46
bda8fd1 to
7d4946f
Compare
oferchen
added a commit
that referenced
this pull request
Nov 10, 2026
oferchen
force-pushed
the
fix/local-acl-xattr-read-once
branch
from
November 10, 2026 19:10
7d4946f to
3fbc26e
Compare
oferchen
force-pushed
the
fix/local-acl-xattr-read-once
branch
from
November 10, 2026 20:35
3fbc26e to
c478ee8
Compare
oferchen
added a commit
that referenced
this pull request
Nov 10, 2026
oferchen
added a commit
that referenced
this pull request
Nov 11, 2026
fix: apply a local -M to the receiver half only Fixes the required upstream-testsuite regression `fake-super-acl-xattr` that #8332 brought to master. Tasks 520, 540 and 641. ## Problem On master, a local copy folds its `-M` values into the client argv, so both halves read one option set. Under `-rA -M--fake-super` that makes the sender fake-super too. It then reads only the source's (empty) `%aacl` stash, and dst gets no `%aacl`/`%dacl`. The upstream test fails with "--fake-super -A should have stored user.rsync.%aacl on dst/f". 3.5.1 forks the receiver, and only the receiver re-parses the `-M` values (pipe.c:143-148). The sender reads the real ACL (acls.c:609-631), and the receiver stashes it with set_xattr_acl (acls.c:933-971). #8332's 540 measurement still holds where both halves run fake-super: `-rA --fake-super` with no `-M`. 3.5.1 stores no `%aacl`/`%dacl` there, re-measured with a named-user ACL and a default dir ACL. That behaviour is unchanged. ## Commits 1. `refactor: split the client run into a repeatable translation pass`. Behaviour-neutral: `execute()` runs `translate()` with a `Pass`, and the process setup runs only on the process pass. The order of every early return and side effect is kept. A test checks that a `--help` early return reads no files and opens no log file. 2. `fix: apply a local -M to the receiver half only`. Two option sets, described below. ### Mechanism 3.5.1 forks the receiver for a local copy. In `pipe.c:109-148` `local_child()`, the child inherits the client's options and re-runs `parse_arguments()` over the `-M` values on top of them. The parent sender keeps the client's own options. So every `-M` option changes the receiver half only. oc used to fold `-M` into the client argv, which gave one option set for both halves. That set was wrong for the sender whenever `-M` named something the sender reads. Now it keeps two option sets, as upstream does: - cli: `parse_args` keeps the client's own parse as `ParsedArgs.local_sender`, but only when a fold happened. The folded parse is the receiver's. Each set's filter order is built from the argv it was parsed from. - `execute()` runs the real process setup on the client's own parse, as 3.5.1's `main()` does, and that parse is also the sender's set. The `-M` fold, the receiver's set, is translated on an inert pass (commit 1: `translate()`/`Pass`). The inert pass sets no globals, opens no log file and reads no password; pipe.c:131-141 clears the child's log file. It replays the `--files-from` list the process pass read rather than reading it again; pipe.c:133 sets the child's `filesfrom_fd = -1`. The run takes its output settings from the client parse and its config from the receiver set, with the sender's attached by `ClientConfig::with_local_sender()`. - core builds the sender's `LocalCopyOptions` from it, with its own filter program, and attaches it with `LocalCopyOptions::with_local_sender()`. - engine: `LocalCopyOptions::sender_half()` (`CopyContext::sender_options()`) returns the sender's set when there is one, and `self` otherwise. Without `-M` both halves read one set, and behaviour is unchanged. ### Side table: which half reads what | read | half | upstream | oc | |---|---|---|---| | `-r` / `-d` (walk, `xfer_dirs`) | sender | flist.c:2436, :2751, :2992 (no generator.c read) | `recursive_enabled`/`dirs_enabled` facades | | `-L` / `-k` / `--copy-unsafe-links` | sender | flist.c:417, :485, :492, :514; sender.c | `copy_*_enabled` facades, `follow_source_symlinks` | | `--files-from` | sender | flist.c:2787-2809; pipe.c:133 clears it in the child | `files_from_enabled` | | filter hide (transfer) | sender | flist.c:1662, :1731 `is_excluded` | `CopyContext.filter_program` + `dir_merge` | | filter protect / delete | receiver | generator.c:285 `delete_in_dir`, :1750 | `receiver_filter_program` + `delete_dir_merge` | | xattr names the receiver may set | receiver | xattrs.c `rsync_xal_set` | `CopyContext::filter_program()` (xattr sync) | | source stat under `--fake-super` | sender | flist.c:497-516 `x_stat`/`x_lstat`; xattrs.c:1372 | virtualize sites (11), `ensure_fake_super_source_stat`, `fake_super_source_stat`, `store_effective_fake_super_if_requested`, hard-link holder reorder | | source ACL/xattr read under `--fake-super` | sender | flist.c:2052-2062 `get_acl`/`get_xattr`; acls.c:599-607 | `source_attrs.rs`, batch ACL read, `FakeSuperSides.sender` | | `%stat` / `%aacl` store | receiver | xattrs.c:1304-1356 `set_stat_xattr`; acls.c:933-971 | unchanged (`fake_super_enabled`) | | `-R` (names) | sender | flist.c:1077, :1753 | sources/orchestration.rs, sources/metadata.rs | | `-R` (dest parents) | receiver | generator.c, receiver.c | context_impl/options/dirs.rs, unchanged | | `--no-implied-dirs` | receiver | generator.c (dir attrs) | unchanged | | `-x` (walk) | sender | flist.c:1375, :1715, :2574, :2989 | planner.rs, sources/orchestration.rs, recursive/mod.rs | | `-x` (delete boundary) | receiver | generator.c:316, :1915 | cleanup.rs, obstacle.rs, unchanged | | everything else | receiver | the forked child | unchanged | ### Cells (MEASURED, same commands against the 3.5.1 tarball build) | command | 3.5.1 | oc before | oc now | |---|---|---|---| | `-d -M-r` | `d/` only | recursed | `d/` only | | `-r -M--no-r` | full tree | "skipping directory ." | full tree | | `-r -M-R` | non-relative names | `tmp/...` relative tree | non-relative names | | `-r --delete -M--exclude=*.tmp` | `x.tmp` sent, dest `y.tmp` kept, `z` deleted | `x.tmp` hidden | as 3.5.1 | | `-r -M--fake-super`, source 0644 with `%stat 100600` | 0644, `%stat 100644 0,0 0:0` | 0600, `100600` | as 3.5.1 | | `-rA -M--fake-super`, named-user ACL | `%aacl` stashed | none | stashed | Cells that stay identical, checked so the split cannot move them: `-M--chmod=o+r` (the receiver applies it; 604 on both), `-M-p`, `-M-x`, `-M--copy-dirlinks`, `-M--remove-source-files`. Tests: - `tests/local_remote_option_sides.rs`: 5 oc-only cells that assert the measured 3.5.1 results, so they run in CI without the oracle. - `tests/local_copy_skip_and_fake_super_parity.rs`: - `receiver_only_fake_super_ignores_the_source_stat_record`: the %stat cell (task 641), oc-only. - `receiver_only_fake_super_stashes_the_real_source_acl`: the ACL cell, oracle comparison. - `options/sides.rs` unit tests. - `cli` `help_returns_before_the_process_pass_reads_its_files`: a help early return still reads no files and opens no log file. ### Not covered - 3.5.1 itself breaks on `-M-l` (rc 22, `recv_file_entry` overflow), `-M--no-l` (hang) and `-M-c` (rc 2, "File-list index ... not in"). These options change the flist shape, so the two halves stop agreeing on the wire format. There is nothing to mirror, so there are no cells. - `-rl -M--copy-links`: 3.5.1 keeps the link. oc refuses the folded receiver argv with a clap conflict between `-l` and `-L`, which 3.5.1 accepts. Filed as task 642 and not folded in, per review. - A `-M` rule that adds a per-dir merge file loads on the receiver chain only. That is correct, but no cell covers it. - On the process pass, the cli still sets its globals (SIMD override, logging) before the help check, the same order as before this PR. - A `-M` option that 3.5.1 applies per process but oc applies once per run takes the client's value in oc. Output levels are the main case. In 3.5.1, `-M-v` makes the forked receiver print `created directory t` (main.c get_local_name), and `-M-vv` adds the generator's `delta-transmission disabled for local transfer or --whole-file`. The client's own output is unchanged. oc prints neither, because its verbosity, itemize, info/debug and out-format are process-global and come from the client parse. These are listed, not approximated. - `-M--log-file=F`: pipe.c:136-140 clears the inherited log file in the receiver, and the `-M` value parsed after it opens the receiver's own. oc opens F from the receiver set when the client parse names no log file. That keeps `remote_option_applies_to_a_local_transfer`. When both name a log file, oc writes only the client's, while 3.5.1 writes receiver lines to F as well. - `-M--copy-links` stays a symlink in 3.5.1. oc's receiver-side parse still refuses `-l` together with `-L` (task 642), so that cell waits for it. ### Upstream testsuite (fake-super-acl-xattr, host, 3.5.1 tarball suite) - non-root: `PASS fake-super-acl-xattr` - root: `PASS fake-super-acl-xattr` The three legs of fake-super-acl-xattr_test.py:89-111 were also replayed directly, against both 3.5.1 and oc. All three give identical results: - `-rA -M--fake-super`: `%aacl` on f, `%dacl` on d. - `-rA --fake-super -M--fake-super`: both kept. - re-sync after `setfacl -k`: `%dacl` removed. The other host-only failures in the same runs are not caused by this PR: - non-root `rrsync-userns-procfs`: "cannot locate the rsync executable" for the debug binary path. - root `operator-path-dir-daemon-leaf` and `operator-path-partial-dir-exclude-daemon`: both compare against a host-only 3.2.7 oracle, and both are daemon `--partial-dir` cells.
oferchen
added a commit
that referenced
this pull request
Nov 13, 2026
## Summary Under `--fake-super`, the network receiver now stashes every received ACL in the `%aacl`/`%dacl` xattrs instead of applying it, as 3.5.1 does. Before, only regular files written through disk_commit took the stash path. Directories, devices, specials, alt-dest matches, batch replay and up-to-date files got the real ACL applied, and they had no stash. Stacked on #8332. ## Changes 1. `fix: keep group_obj when condensing a wire-received fake-super ACL` - `RsyncAcl::condense_for_fake_super_store` re-applied the sender's strip (`rsync_acl_strip_perms()`, acls.c:142-159) to an ACL that had already been stripped on the wire. - When the mask was stripped (it equals the mode's group bits), the second strip saw `mask == NO_ENTRY` and also blanked a `group_obj` that differs from the mask. - 3.5.1 stores that `group::` entry (acls.c:1228-1238, `duo_item->racl` verbatim after recv_rsync_acl()'s mask restoration, acls.c:1000-1007). - The mask restoration now runs before the strip as well, so a filesystem-read ACL and a wire-received ACL condense to the same stored form. - This also fixes the existing transferred-file path, which had the same loss. 2. `fix: stash ACLs under --fake-super on every receiver path` - `apply_acls_from_receiver_cache` (transfer `receiver/pipeline_setup.rs`) takes `fake_super`. When it is set, it calls `store_acls_via_fake_super` (upstream: acls.c:1228 `set_rsync_acl()`, `am_root < 0` arm). - All six callers pass it: directory creation (x2), specials, alt-dest quick-check, the candidate quick-check match and batch replay. ## Evidence - New oracle test `tests/fake_super_receiver_acl_stash.rs`: - A 3.5.1 client pushes `-rtA -M--fake-super` to each server (3.5.1, oc). - The fixture is a directory with access and default named ACLs and a file with a named ACL. - The client then pushes again after changing the source ACLs (mask above `group::`), which reaches the existing directory and the up-to-date file. - Real ACLs and stashes must match between the servers, and the oracle must show stashes and no real named entries. - It passes against the 3.5.1 tarball binary. - New unit test `condensing_the_wire_form_keeps_a_group_obj_below_the_mask`. - Mutations, each caught: - Drop the leading mask restore: unit test and oracle cell fail. - Ignore `fake_super` in `apply_acls_from_receiver_cache`: oracle cell fails. - Pass `false` at the up-to-date-file call site: oracle cell fails (second round). - Gates: - fmt-all: ok. - Workspace clippy: ok. - windows-gnu clippy (transfer, metadata, protocol): ok. - No-default clippy for transfer, protocol and metadata, plus transfer with `xattr` only and with `acl` only: ok. - dead_code_census: OK. - Citation ratchet: OK. - Targeted nextest (protocol, metadata, transfer, bin; acl / fake_super filters): 521/521 passed. ## Not in scope - `%stat` ids under `--fake-super` without `-o`/`-g`: 3.5.1 wrote `2465469312:2465469312` for a file where oc writes `0:0`. Tracked in task 496.
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.
fix: read local ACL and xattrs once, before the delete pass
Task 520. Builds on #8288 (merged).
Problem
A local copy read each entry's ACL and xattrs at apply time, after the directory's
--deletesweep had already run. When a source entry's xattrs could not be read, oc reported the failure but had already deleted in that directory. 3.5.1 reads them while building the file list (flist.c:2050-2087send_file_name:get_acl, thenget_xattr). A failure setsio_error |= IOERR_GENERALand drops the entry, so the generator'sdelete_in_dirprints "IO error encountered -- skipping file deletion" and deletes nothing. oc's divergence was data loss: an extraneous destination file was removed where 3.5.1 keeps it.Change
plan_directory_entries*, the flist-build analogue) reads each entry's ACL and xattrs once. A read failure records the flist I/O error and drops the entry, the same path as the existing iconv drop. So--deletesees the error before it runs.PlannedEntry.attrsintoCopyContext.entry_attrsat dispatch. Every consumer reads that slot instead of re-reading the source: xattr apply, ACL apply (LinuxLocalAcls::apply), the itemizexbit, batch capture and--delay-updates(DeferredUpdate.source_attrs). A directory frame takes its own attrs at frame start; operands are read inhandlers.rs.sync_xattrs_from_list(list-driven apply plusprune_unretained) and a fallibleLocalAcls::readwhose error names the ACL type, matching acls.c:752-755 (get_acl: sys_acl_get_file(%s, %s)).-LX: the local sender reads xattrs without following links, which mirrors 3.5.1'ssys_llistxattr/sys_lgetxattr(xattrs.c:162,200). ACLs still follow, assys_acl_get_filedoes. When an unsafe operand symlink is dereferenced,copy_symlinkre-reads the referent's attrs.Read count (strace, 100 files, source-path calls only, base = #8288 as merged, head 2c3bb6f)
-rX-rX --write-batch-rA-rA --write-batchEach entry is read once: 2 reads down to 1 under
-X, and 3 down to 1 with--write-batch.-rAwas already at one read;-rA --write-batchdrops from 2 to 1.Tests
tests/local_xattr_read_failure.rs: each cell runs against 3.5.1 and oc. The headline cell islocal_delete_is_skipped_after_an_unreadable_xattr, which keeps the extraneous file and prints "IO error encountered -- skipping file deletion" with exit 23. The other cells cover the dropped file, the dry run and the dropped operand.tests/local_attrs_parity.rs: oc vs 3.5.1 for xattrs landing, itemize drift, xattr prune on an in-place directory update, and ACLs landing.Known limits
sync_acls_if_requested). Only Linux takes the ACL from the planner slot. The xattr read moves on every platform.sys_acl_get_filefail needs root (or a filesystem that refuses it) on the runner. The xattr failure is covered as non-root.Folded in: local-copy residuals (task 540)
Three divergences found while building the change above, each checked against the 3.5.1 tarball build.
--fake-super -AACL stashes--fake-supersets the globalam_root = -1(options.c:672) and is never passed to the server. So in a local copy the sender runs fake-super too, and so does the client side of a push. That sender reads only the%aacl/%daclstash:get_rsync_acl()returns early whenget_xattr_acl()finds none (acls.c:599-607). The ACL stays the empty oneget_acl_fdat()started with (acls.c:766), never the real filesystem ACL. The receiver then stores a stash only whenrsync_acl_equal_enough()/rsync_acl_equal()find it differs from what the destination holds (set_acl_fdat(), acls.c:1388-1415).oc diverged in two ways:
Fix:
metadata::read_sender_aclis the one sender-side read. It is used byLocalAcls::read, the local fake-super sync, the engine batch writer and the network generator.update_fake_super_access_acl/update_fake_super_default_acladd the equality gate to both store paths: the local copy, and the network receiver's file commit.Behaviour change:
--fake-super -Acopy of files that carry only permission bits now writes no ACL xattrs, as 3.5.1 does. A source's own stash is still carried.--fake-super -Apush no longer sends the real named ACL entries. 3.5.1's client sends only the stash too (oracle cellfake_super_push_sends_the_stash_not_the_real_acl).--copy-unsafe-linkswithout-lreadlink_stat()dereferences an unsafe link before-lmatters (flist.c:482-506). oc skipped such links, both as an operand and inside a tree. The planner (both variants) and the operand handler now dereference them. A link that stays a link is still skipped when-lis off (generator.c:2109-2115).Itemized row for a skipped non-regular entry
generator.c:2109-2115 prints
skipping non-regular file "%s"and jumps tocleanupwithout itemizing. oc printed an extra.S/.Lrow for every such entry, not just links.emit_out_formatnow drops it.Tests
tests/local_copy_skip_and_fake_super_parity.rs, 5 cells against 3.5.1:sync_acls_via_fake_super_stashes_named_entry_instead_of_applyingencoded the old fallback. It is replaced bysync_acls_via_fake_super_carries_the_stash_not_the_real_acl.Not in this PR
--fake-superinstead of stashing it.-i, 3.5.1 prints a directory's skip notices before itscd+++row; the cells compare those rows as a set.macOS local
-Xname mappingOnce the local copy read its xattrs as a list, it also sent names through oc's wire mapping and back:
protocol::xattr::local_to_wirekeepsrsync.*names verbatim on non-Linux hosts. That is a documented deviation, owned by task 257.wire_to_localmirrors 3.5.1'sreceive_xattr()(xattrs.c:887-901) and re-addsrsync.under am_root.rsync.nonuser.equalintorsync.rsync.nonuser.equal. This failed thexattrsandxattrs-hlinkcells on both macOS pipe legs.3.5.1's sender strips the prefix before it reaches the wire (xattrs.c:537-560), so its round trip is lossless.
Fix: the local list path now uses
protocol::xattr::local_from_own_wire, the exact inverse oflocal_to_wire. No wire bytes change, and task 257 keeps the wire-side deviation.Testing:
local_from_own_wire_inverts_local_to_wirechecks the round trip foruser., plain,rsync.nonuser,rsync.%stat, nesteduser.user.and non-UTF-8 names.xattrs,xattrs-hlink); I have no local macOS run.