Skip to content

fix: keep ACLs in local batches and INC_RECURSE sub-lists - #8281

Merged
oferchen merged 4 commits into
masterfrom
fix/local-batch-acls
Nov 3, 2026
Merged

oferchen merged 4 commits into
masterfrom
fix/local-batch-acls

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

Two ACL losses, both silent (exit 0):

  1. Local --write-batch -A carried only the mode-derived ACL. The engine batch writer never read the source ACL, so named user/group entries and a directory's default ACL were missing from the batch, and upstream 3.5.1 replayed it without them. The writer now reads each entry's ACL as the generator does for a network send (flist.c:2048-2055 get_acl(), the --fake-super stash first), hands it to the flist writer before the entry (held alongside the entry under INC_RECURSE), names ACL ids inline under INC_RECURSE (acls.c:827) and adds them to the uid/gid id lists otherwise (acls.c:821-826).

  2. An INC_RECURSE receiver dropped the ACL of every file listed in a sub-list. The receiver copied its ACL cache once, after the initial file list (receiver/transfer/setup/context.rs), so an entry whose ACL first appears in a later sub-list named an index the appliers never saw, and the file kept only what its parent's default ACL gave it. Pulls default to INC_RECURSE, so oc-rsync -rA host:src/ dst/ hit it, as did an oc replay of an incremental batch. The shared cache (LiveAclCache, an Arc<RwLock<AclCache>>) is now extended after every sub-list with only the ACLs that list added (AclCache::extend_from), matching upstream's single growing access_acl_list/default_acl_list (acls.c:94-95, acls.c:1016-1024). No per-sub-list clone of the whole cache; memory is the same one copy as before.

Tests

  • tests/batch_upstream_oracle.rs local_batch_carries_named_acl_entries_like_upstream: records with oc and 3.5.1 under INC_RECURSE, --no-inc-recursive and --protocol=29, replays each batch with both, and compares getfacl of every path with the source. It also checks each batch names the ACL's user (inline or in the id lists).
  • tests/inc_recurse_receiver_acls.rs inc_recurse_receiver_applies_sub_list_acls: oc and 3.5.1 as client and server, pull and push, with and without --inc-recursive, over a remote-shell wrapper; the fixture has a default ACL on a sub-list directory and a different ACL on a file inside it. The oc-to-oc cells run without an upstream binary.
  • AclCache::extend_from unit test.

The receiver test was committed failing before the fix (cell client=oc server=oc push=false --inc-recursive: sub/b.log showed the inherited user:nobody:r-x/group:nobody:rwx entries instead of its own group:nobody:r--).

Gates: fmt; Linux and windows-gnu workspace clippy; nextest protocol 6172, engine 4918, batch 227, transfer 3294, metadata 723, core 2941, cli 3896, daemon 2147, all passed; acl/batch/inc integration tests 78/78; interop oracle 664 cells, PASS=638, XFAIL=26, FAIL=0.

Mutations (all killed)

Mutation Killed by
Restore the one-time snapshot (skip the per-sub-list extend) both integration tests
extend_from copies nothing both integration tests, unit test
Flat batch skips set_pending_acl batch oracle
INC batch skips set_pending_acl batch oracle
No inline ACL names under INC_RECURSE batch oracle (name check)
ACL ids left out of the id lists batch oracle (name check)
Never read the source ACL batch oracle

Not covered

  • Upstream drops a file from the list with IOERR_GENERAL when get_acl() fails (flist.c:2052-2055); the batch writer, like the generator, falls back to the mode-derived ACL. Unchanged here.
  • Batch writer xattrs were not checked for the same gap.

@oferchen
oferchen force-pushed the fix/local-batch-acls branch from e60638d to aa6d2f8 Compare November 3, 2026 06:40
@oferchen oferchen closed this Nov 3, 2026
@oferchen oferchen reopened this Nov 3, 2026
@oferchen
oferchen merged commit 641fdc7 into master Nov 3, 2026
81 of 130 checks passed
@oferchen
oferchen deleted the fix/local-batch-acls branch November 3, 2026 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant