Repository navigation
fix(filters): scope ! clear-rules to local merge context - #5905
Merged
Merged
Conversation
1 of 3 tasks
oferchen
force-pushed
the
fix/uts-dd-exclude-2-bang-scope-isolation
branch
2 times, most recently
from
June 18, 2026 01:24
68e7d37 to
8e68613
Compare
A `!` (FILTRULE_CLEAR_LIST) rule inside a merged filter file now clears only rules accumulated from that file, mirroring upstream exclude.c:pop_filter_list() (rsync-3.4.4 exclude.c:574-590), which truncates the local section of the rule list while leaving inherited parent-scope rules in place. Previously, expanding a merge file via FilterSet::from_rules_with_merge_expansion flattened the merge file's rules into the parent stream, causing a `!` from the file to also drop the caller's preceding rules. Add a `scope_local_clear` helper at the merge module boundary and apply it at both expansion sites (read_rules_recursive_impl when expanding a nested `. FILE` and expand_merge_rules at the outer call). Inline `!` in the top-level rule stream still clears the global list, matching upstream's behaviour at CLI scope where there is no inherited section. Tests cover CLI-inline clear, single-file merge clear, two-level nested merge clear, and the parent-survives fixture from UTS-DD-exclude.2.
oferchen
force-pushed
the
fix/uts-dd-exclude-2-bang-scope-isolation
branch
from
June 18, 2026 04:13
b68be56 to
e8ae145
Compare
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
A `!` (FILTRULE_CLEAR_LIST) rule inside a merged filter file now clears only rules accumulated from that file, mirroring upstream exclude.c:pop_filter_list() (rsync-3.4.4 exclude.c:574-590), which truncates the local section of the rule list while leaving inherited parent-scope rules in place. Previously, expanding a merge file via FilterSet::from_rules_with_merge_expansion flattened the merge file's rules into the parent stream, causing a `!` from the file to also drop the caller's preceding rules. Add a `scope_local_clear` helper at the merge module boundary and apply it at both expansion sites (read_rules_recursive_impl when expanding a nested `. FILE` and expand_merge_rules at the outer call). Inline `!` in the top-level rule stream still clears the global list, matching upstream's behaviour at CLI scope where there is no inherited section. Tests cover CLI-inline clear, single-file merge clear, two-level nested merge clear, and the parent-survives fixture from UTS-DD-exclude.2.
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
A `!` (FILTRULE_CLEAR_LIST) rule inside a merged filter file currently flattens its rules into the parent rule stream, so the `!` clears the caller's preceding rules in addition to the merge file's own rules. Upstream rsync scopes the clear to the local section of the rule list - inherited parent-scope rules survive.
This patch resolves `Clear` rules at the merge-expansion boundary so a `!` inside a merge file only retires the rules accumulated within that file's scope. Inline `!` in the top-level rule stream still clears the global list, matching upstream behaviour at CLI scope where there is no inherited section.
Upstream reference
`target/interop/upstream-src/rsync-3.4.4/exclude.c`:
Implementation
Test plan
Resolves UTS-DD-exclude.2 (#4527).