feat(metadata): wire --debug=ACL producer emissions (3.4.1 parity)#4117
Merged
Conversation
Upstream rsync 3.4.1 emits exactly one DEBUG_GTE(ACL, 1) line in
`acls.c::default_perms_for_dir` (`acls.c:1133-1134`):
"got ACL-based default perms %o for directory %s\n"
The function is invoked from the generator and receiver
(`generator.c:1337-1340`, `receiver.c:846-851`) once per unique parent
directory whenever `--acls` is on but `--perms` is off, so dest_mode()
can fold the parent's default ACL bits into newly-created children.
This change introduces the equivalent on the oc-rsync side:
- `crates/protocol/src/acl/trace.rs` - `trace_default_perms_for_dir`
helper emitting the upstream-verbatim wording via `debug_log!`,
with pinning tests covering the wire shape and level gating.
- `crates/metadata/src/acl_exacl.rs::default_perms_for_dir` - reads
the directory's POSIX default ACL via `exacl::getfacl`, extracts
the user/group/other entries (mirroring `rsync_acl_get_perms`),
and fires the trace when a user_obj is present. Filesystem errors
and absent default ACLs fall back to `ACCESSPERMS & ~umask` without
emitting, matching upstream's silent fallback.
- Cross-platform stubs in `acl_noop.rs`, `acl_stub.rs`, and
`acl_windows.rs` return the umask-derived default without emitting,
matching upstream's `#ifdef SUPPORT_ACLS` guard.
- `crates/transfer/src/receiver/directory/creation.rs` invokes the
helper from `create_directories` per unique new parent when
`acls && !perms`, gated to the platforms where the exacl path is
compiled.
- Unit tests in `acl_exacl.rs` assert the byte-exact emission against
a real default ACL on Linux/FreeBSD and confirm the level-0 gate
suppresses the line.
- `docs/audits/debug-flags-verbosity-matrix.md` rolls ACL from
missing to impl, updates the G3 gap, and refreshes the insertion
table to point at the wired call site.
Closes #2180.
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.
Summary
DEBUG_GTE(ACL, 1)emission (acls.c:1133-1134,"got ACL-based default perms %o for directory %s") via a newtrace_default_perms_for_dirhelper incrates/protocol/src/acl/trace.rs.default_perms_for_dirhelper incrates/metadata/src/acl_exacl.rsthat reads the directory's POSIX defaultACL through
exacl::getfacl, folds the user/group/other entries into thepermission bits (mirroring upstream's
rsync_acl_get_perms), and fires thetrace when a
user_objentry is present. Filesystem errors and missingdefault ACLs fall back to
ACCESSPERMS & ~umaskwithout emitting,matching upstream's silent fallback.
acl_noop.rs,acl_stub.rs,acl_windows.rs)return the umask-derived default without emitting, mirroring upstream's
#ifdef SUPPORT_ACLSguard.crates/transfer/src/receiver/directory/creation.rs::create_directoriesper unique new parent when
acls && !perms(mirrorsgenerator.c:1337-1340and
receiver.c:846-851).docs/audits/debug-flags-verbosity-matrix.md: ACL rolls frommissing to impl, G3 counter drops to 8, and the per-flag insertion table
records the wired call site.
Closes #2180.
Test plan
crates/protocol/src/acl/trace.rspin theupstream wire shape and level gating.
crates/metadata/src/acl_exacl.rsconfirmthe emission fires against a real default ACL on Linux/FreeBSD and
is suppressed at level 0.