Skip to content

feat(metadata): wire --debug=ACL producer emissions (3.4.1 parity)#4117

Merged
oferchen merged 1 commit into
masterfrom
feat/debug-acl-emissions-2180
May 16, 2026
Merged

feat(metadata): wire --debug=ACL producer emissions (3.4.1 parity)#4117
oferchen merged 1 commit into
masterfrom
feat/debug-acl-emissions-2180

Conversation

@oferchen
Copy link
Copy Markdown
Owner

Summary

  • Add the upstream-verbatim DEBUG_GTE(ACL, 1) emission (acls.c:1133-1134,
    "got ACL-based default perms %o for directory %s") via a new
    trace_default_perms_for_dir helper in crates/protocol/src/acl/trace.rs.
  • Wire a production default_perms_for_dir helper in
    crates/metadata/src/acl_exacl.rs that reads the directory's POSIX default
    ACL through exacl::getfacl, folds the user/group/other entries into the
    permission bits (mirroring upstream's rsync_acl_get_perms), and fires the
    trace when a user_obj entry is present. Filesystem errors and missing
    default ACLs fall back to ACCESSPERMS & ~umask without emitting,
    matching upstream's silent fallback.
  • Cross-platform stubs (acl_noop.rs, acl_stub.rs, acl_windows.rs)
    return the umask-derived default without emitting, mirroring upstream's
    #ifdef SUPPORT_ACLS guard.
  • Invoke the helper from
    crates/transfer/src/receiver/directory/creation.rs::create_directories
    per unique new parent when acls && !perms (mirrors generator.c:1337-1340
    and receiver.c:846-851).
  • Update docs/audits/debug-flags-verbosity-matrix.md: ACL rolls from
    missing to impl, G3 counter drops to 8, and the per-flag insertion table
    records the wired call site.

Closes #2180.

Test plan

  • CI: fmt + clippy across the workspace.
  • CI: nextest on stable across Linux/macOS/Windows/musl.
  • CI: new unit tests in crates/protocol/src/acl/trace.rs pin the
    upstream wire shape and level gating.
  • CI: new unit tests in crates/metadata/src/acl_exacl.rs confirm
    the emission fires against a real default ACL on Linux/FreeBSD and
    is suppressed at level 0.

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.
@github-actions github-actions Bot added the enhancement New feature or request label May 16, 2026
@oferchen oferchen merged commit eeb15fb into master May 16, 2026
27 of 29 checks passed
@oferchen oferchen deleted the feat/debug-acl-emissions-2180 branch May 16, 2026 02:21
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