Skip to content

fix: child .rsync-filter rules must override parent directory rules - #4006

Merged
oferchen merged 1 commit into
masterfrom
fix/filter-merge-child-precedence-2128
May 13, 2026
Merged

oferchen merged 1 commit into
masterfrom
fix/filter-merge-child-precedence-2128

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

Per-directory merge files (: .rsync-filter) inherit rules from parent directories. When a child directory's .rsync-filter contains rules that conflict with a parent's, the child rules must win under first-match semantics. Our implementation was evaluating parent rules first, the reverse of upstream.

Upstream behavior

In exclude.c:check_filter(), the merged rule list stores local (child) rules at the head and inherited (parent) rules at the tail. Traversal is head-first, so child rules are evaluated and matched before parent rules.

Our implementation (before this fix)

context_impl/transfer.rs populates layers[index] via .push(segment) as we descend into subdirectories. Root segment lands at layers[0]; current directory at layers[N-1]. The two evaluation loops in filter_program/program.rs iterated this Vec forward, so parent rules were evaluated and matched first - exactly the opposite of upstream.

Fix

Iterate layers.iter().rev() so the newest-pushed (child) segment runs first. Two call sites:

  • FilterProgram::evaluate() (line 181)
  • FilterProgram::excluded_dir_by_non_dir_rule() (line 222)

Closes #2128.

Test plan

  • New unit test child_dir_merge_rules_override_parent_rules: parent excludes debug.log, child includes debug.log, child must win.
  • CI runs full filter test suite to verify no regression in existing dir-merge behavior.

Per-directory merge files (`: .rsync-filter`) inherit from parent
directories by design. When a child directory's `.rsync-filter`
contains rules that conflict with a parent's, the child rules must win
under first-match semantics.

Upstream stores the merged list with local (child) rules at the head
and inherited (parent) rules at the tail (exclude.c:check_filter),
traversing head-first. Our implementation pushed child segments to the
back of a Vec via `layers[index].push(segment)` and iterated forward,
causing parent rules to be evaluated first - the reverse of upstream.

Reverse the iteration in `evaluate()` and `excluded_dir_by_non_dir_rule()`
so the newest-pushed (child) segment is checked first. Add a unit test
covering the child-overrides-parent precedence.
@github-actions github-actions Bot added the bug Something isn't working label May 13, 2026
@oferchen
oferchen merged commit 65efefc into master May 13, 2026
37 of 39 checks passed
@oferchen
oferchen deleted the fix/filter-merge-child-precedence-2128 branch May 14, 2026 14:58
oferchen added a commit that referenced this pull request May 18, 2026
…4006)

Per-directory merge files (`: .rsync-filter`) inherit from parent
directories by design. When a child directory's `.rsync-filter`
contains rules that conflict with a parent's, the child rules must win
under first-match semantics.

Upstream stores the merged list with local (child) rules at the head
and inherited (parent) rules at the tail (exclude.c:check_filter),
traversing head-first. Our implementation pushed child segments to the
back of a Vec via `layers[index].push(segment)` and iterated forward,
causing parent rules to be evaluated first - the reverse of upstream.

Reverse the iteration in `evaluate()` and `excluded_dir_by_non_dir_rule()`
so the newest-pushed (child) segment is checked first. Add a unit test
covering the child-overrides-parent precedence.
oferchen added a commit that referenced this pull request Jun 10, 2026
Adds a fourth IoUringPolicy variant (SqpollOff) wired to the new --no-io-uring-sqpoll flag. The variant keeps io_uring active for file and socket I/O but suppresses IORING_SETUP_SQPOLL via a process-wide gate that build_ring() and the session-pool ring builder consult. This gives operators a deterministic opt-out for rootless containers and Kubernetes pods that cannot grant CAP_SYS_NICE, instead of relying on the kernel's EPERM fallback path.

Adds docs/deployment/kubernetes.md covering Pod manifests for SQPOLL-enabled and SQPOLL-suppressed workloads, daemon-as-Pod deployment, Pod Security Admission profile interactions, and the tradeoff table. Extends docs/deployment/container-io-uring.md (IKV-F.6) with a K8s rootless-opt-out subsection and adds the new flag to docs/deployment/io-uring-feature-matrix.md.

Bundles SQP-K8S.1 / .3 / .4 (#4004 / #4006 / #4007). The rootless throughput bench (SQP-K8S.2) requires container access and is deferred to a follow-up PR.
oferchen added a commit that referenced this pull request Aug 24, 2026
…4006)

Per-directory merge files (`: .rsync-filter`) inherit from parent
directories by design. When a child directory's `.rsync-filter`
contains rules that conflict with a parent's, the child rules must win
under first-match semantics.

Upstream stores the merged list with local (child) rules at the head
and inherited (parent) rules at the tail (exclude.c:check_filter),
traversing head-first. Our implementation pushed child segments to the
back of a Vec via `layers[index].push(segment)` and iterated forward,
causing parent rules to be evaluated first - the reverse of upstream.

Reverse the iteration in `evaluate()` and `excluded_dir_by_non_dir_rule()`
so the newest-pushed (child) segment is checked first. Add a unit test
covering the child-overrides-parent precedence.
oferchen added a commit that referenced this pull request Aug 24, 2026
…4006)

Per-directory merge files (`: .rsync-filter`) inherit from parent
directories by design. When a child directory's `.rsync-filter`
contains rules that conflict with a parent's, the child rules must win
under first-match semantics.

Upstream stores the merged list with local (child) rules at the head
and inherited (parent) rules at the tail (exclude.c:check_filter),
traversing head-first. Our implementation pushed child segments to the
back of a Vec via `layers[index].push(segment)` and iterated forward,
causing parent rules to be evaluated first - the reverse of upstream.

Reverse the iteration in `evaluate()` and `excluded_dir_by_non_dir_rule()`
so the newest-pushed (child) segment is checked first. Add a unit test
covering the child-overrides-parent precedence.
oferchen added a commit that referenced this pull request Aug 24, 2026
Adds a fourth IoUringPolicy variant (SqpollOff) wired to the new --no-io-uring-sqpoll flag. The variant keeps io_uring active for file and socket I/O but suppresses IORING_SETUP_SQPOLL via a process-wide gate that build_ring() and the session-pool ring builder consult. This gives operators a deterministic opt-out for rootless containers and Kubernetes pods that cannot grant CAP_SYS_NICE, instead of relying on the kernel's EPERM fallback path.

Adds docs/deployment/kubernetes.md covering Pod manifests for SQPOLL-enabled and SQPOLL-suppressed workloads, daemon-as-Pod deployment, Pod Security Admission profile interactions, and the tradeoff table. Extends docs/deployment/container-io-uring.md (IKV-F.6) with a K8s rootless-opt-out subsection and adds the new flag to docs/deployment/io-uring-feature-matrix.md.

Bundles SQP-K8S.1 / .3 / .4 (#4004 / #4006 / #4007). The rootless throughput bench (SQP-K8S.2) requires container access and is deferred to a follow-up PR.
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