Repository navigation
fix(filters): parse :C modifier on per-directory merge rules for CVS-ignore - #5842
Merged
Merged
Conversation
…ignore When a per-directory merge rule uses the `:C` (or `.C`) short form with an empty pattern, the parser rejected it as "unrecognized filter rule" instead of defaulting the filename to `.cvsignore`, and the `C` (CVS-ignore) modifier was never propagated from `RuleModifiers` onto the resulting `FilterRule`. The wire-format path and the CLI `--filter :C` path already handle this correctly; only merge files read from disk via `parse_rules` (e.g. `mid/.filt`) were affected. This breaks the upstream `merge` and `exclude-lsh` testsuite scenarios (task #4428, UTS-V4.B). Add a `cvs_mode` flag to `FilterRule` with a `with_cvs_mode` builder and `is_cvs_mode` accessor; propagate it through `RuleModifiers::apply`; and in `try_parse_short_form`, when a `:`/`.` rule has empty pattern and the `C` modifier set, default to the filename `.cvsignore`. upstream references (rsync-3.4.4): - exclude.c:1248-1255: `:C` sets FILTRULE_NO_PREFIXES | FILTRULE_WORD_SPLIT | FILTRULE_NO_INHERIT | FILTRULE_CVS_IGNORE. - exclude.c:1324: empty pattern only errors when FILTRULE_CVS_IGNORE is unset. - exclude.c:1404-1408: empty-pattern merge defaults to `.cvsignore`. - testsuite/merge.test, testsuite/exclude-lsh.test:86-88: failing fixtures.
The :C modifier work added a cvs_mode field to FilterRule but missed
the test-side struct literal initializations in crates/filters/src/
compiled/{clear,mod,rule}.rs. The build now fails with E0063 because
those literals omit the new field.
Add cvs_mode: false to every FilterRule struct literal in those test
modules so the field set matches the public struct definition.
Owner
Author
|
NACK — Root cause: the parsing fix is incomplete. When
For a complete fix: when loading a merge file, walk its rules for |
2 tasks
oferchen
added a commit
that referenced
this pull request
Jun 16, 2026
…o .cvsignore PR #5842 fixed the merge-file parser to accept a bare `:C` line by adding `cvs_mode` to `FilterRule`. Two related wire-side gaps still let the upstream `exclude` / `exclude-lsh` testsuite fail when `-f:C -f-C` is invoked over remote shell: - `build_wire_format_rules` ignored the `C` modifier when encoding a DirMerge spec, because `DirMergeOptions` had no dedicated cvs-mode bit. The CLI parsed `:C` correctly, but `cvs_exclude` was always false on the wire, so the remote sender never saw the `C` flag. - `wire_rule_to_dir_merge_config` did not implement upstream `exclude.c:1404-1408`'s "empty pattern defaults to `.cvsignore`" fallback, so a wire rule like `:C ` (cvs_exclude set, no pattern) produced a `DirMergeConfig` with an empty filename and silently disabled per-directory `.cvsignore` lookup. Add a `cvs_mode` field to `DirMergeOptions` with `cvs_mode()` / `is_cvs_mode()` accessors, set it from the CLI `parse_merge_modifiers` `C` branch, forward it as `cvs_exclude=true` in `build_wire_format_rules`, and substitute `.cvsignore` as the default pattern inside `wire_rule_to_dir_merge_config` when the wire rule has cvs_exclude set with no pattern.
3 of 5 tasks
oferchen
added a commit
that referenced
this pull request
Jun 16, 2026
…o .cvsignore PR #5842 fixed the merge-file parser to accept a bare `:C` line by adding `cvs_mode` to `FilterRule`. Two related wire-side gaps still let the upstream `exclude` / `exclude-lsh` testsuite fail when `-f:C -f-C` is invoked over remote shell: - `build_wire_format_rules` ignored the `C` modifier when encoding a DirMerge spec, because `DirMergeOptions` had no dedicated cvs-mode bit. The CLI parsed `:C` correctly, but `cvs_exclude` was always false on the wire, so the remote sender never saw the `C` flag. - `wire_rule_to_dir_merge_config` did not implement upstream `exclude.c:1404-1408`'s "empty pattern defaults to `.cvsignore`" fallback, so a wire rule like `:C ` (cvs_exclude set, no pattern) produced a `DirMergeConfig` with an empty filename and silently disabled per-directory `.cvsignore` lookup. Add a `cvs_mode` field to `DirMergeOptions` with `cvs_mode()` / `is_cvs_mode()` accessors, set it from the CLI `parse_merge_modifiers` `C` branch, forward it as `cvs_exclude=true` in `build_wire_format_rules`, and substitute `.cvsignore` as the default pattern inside `wire_rule_to_dir_merge_config` when the wire rule has cvs_exclude set with no pattern.
oferchen
added a commit
that referenced
this pull request
Jun 17, 2026
…o .cvsignore PR #5842 fixed the merge-file parser to accept a bare `:C` line by adding `cvs_mode` to `FilterRule`. Two related wire-side gaps still let the upstream `exclude` / `exclude-lsh` testsuite fail when `-f:C -f-C` is invoked over remote shell: - `build_wire_format_rules` ignored the `C` modifier when encoding a DirMerge spec, because `DirMergeOptions` had no dedicated cvs-mode bit. The CLI parsed `:C` correctly, but `cvs_exclude` was always false on the wire, so the remote sender never saw the `C` flag. - `wire_rule_to_dir_merge_config` did not implement upstream `exclude.c:1404-1408`'s "empty pattern defaults to `.cvsignore`" fallback, so a wire rule like `:C ` (cvs_exclude set, no pattern) produced a `DirMergeConfig` with an empty filename and silently disabled per-directory `.cvsignore` lookup. Add a `cvs_mode` field to `DirMergeOptions` with `cvs_mode()` / `is_cvs_mode()` accessors, set it from the CLI `parse_merge_modifiers` `C` branch, forward it as `cvs_exclude=true` in `build_wire_format_rules`, and substitute `.cvsignore` as the default pattern inside `wire_rule_to_dir_merge_config` when the wire rule has cvs_exclude set with no pattern.
oferchen
added a commit
that referenced
this pull request
Jun 17, 2026
…o .cvsignore PR #5842 fixed the merge-file parser to accept a bare `:C` line by adding `cvs_mode` to `FilterRule`. Two related wire-side gaps still let the upstream `exclude` / `exclude-lsh` testsuite fail when `-f:C -f-C` is invoked over remote shell: - `build_wire_format_rules` ignored the `C` modifier when encoding a DirMerge spec, because `DirMergeOptions` had no dedicated cvs-mode bit. The CLI parsed `:C` correctly, but `cvs_exclude` was always false on the wire, so the remote sender never saw the `C` flag. - `wire_rule_to_dir_merge_config` did not implement upstream `exclude.c:1404-1408`'s "empty pattern defaults to `.cvsignore`" fallback, so a wire rule like `:C ` (cvs_exclude set, no pattern) produced a `DirMergeConfig` with an empty filename and silently disabled per-directory `.cvsignore` lookup. Add a `cvs_mode` field to `DirMergeOptions` with `cvs_mode()` / `is_cvs_mode()` accessors, set it from the CLI `parse_merge_modifiers` `C` branch, forward it as `cvs_exclude=true` in `build_wire_format_rules`, and substitute `.cvsignore` as the default pattern inside `wire_rule_to_dir_merge_config` when the wire rule has cvs_exclude set with no pattern.
oferchen
added a commit
that referenced
this pull request
Jun 17, 2026
…o .cvsignore PR #5842 fixed the merge-file parser to accept a bare `:C` line by adding `cvs_mode` to `FilterRule`. Two related wire-side gaps still let the upstream `exclude` / `exclude-lsh` testsuite fail when `-f:C -f-C` is invoked over remote shell: - `build_wire_format_rules` ignored the `C` modifier when encoding a DirMerge spec, because `DirMergeOptions` had no dedicated cvs-mode bit. The CLI parsed `:C` correctly, but `cvs_exclude` was always false on the wire, so the remote sender never saw the `C` flag. - `wire_rule_to_dir_merge_config` did not implement upstream `exclude.c:1404-1408`'s "empty pattern defaults to `.cvsignore`" fallback, so a wire rule like `:C ` (cvs_exclude set, no pattern) produced a `DirMergeConfig` with an empty filename and silently disabled per-directory `.cvsignore` lookup. Add a `cvs_mode` field to `DirMergeOptions` with `cvs_mode()` / `is_cvs_mode()` accessors, set it from the CLI `parse_merge_modifiers` `C` branch, forward it as `cvs_exclude=true` in `build_wire_format_rules`, and substitute `.cvsignore` as the default pattern inside `wire_rule_to_dir_merge_config` when the wire rule has cvs_exclude set with no pattern.
oferchen
added a commit
that referenced
this pull request
Jun 17, 2026
…o .cvsignore PR #5842 fixed the merge-file parser to accept a bare `:C` line by adding `cvs_mode` to `FilterRule`. Two related wire-side gaps still let the upstream `exclude` / `exclude-lsh` testsuite fail when `-f:C -f-C` is invoked over remote shell: - `build_wire_format_rules` ignored the `C` modifier when encoding a DirMerge spec, because `DirMergeOptions` had no dedicated cvs-mode bit. The CLI parsed `:C` correctly, but `cvs_exclude` was always false on the wire, so the remote sender never saw the `C` flag. - `wire_rule_to_dir_merge_config` did not implement upstream `exclude.c:1404-1408`'s "empty pattern defaults to `.cvsignore`" fallback, so a wire rule like `:C ` (cvs_exclude set, no pattern) produced a `DirMergeConfig` with an empty filename and silently disabled per-directory `.cvsignore` lookup. Add a `cvs_mode` field to `DirMergeOptions` with `cvs_mode()` / `is_cvs_mode()` accessors, set it from the CLI `parse_merge_modifiers` `C` branch, forward it as `cvs_exclude=true` in `build_wire_format_rules`, and substitute `.cvsignore` as the default pattern inside `wire_rule_to_dir_merge_config` when the wire rule has cvs_exclude set with no pattern.
oferchen
added a commit
that referenced
this pull request
Jun 17, 2026
…5817) * fix(filters): fall through to outer scopes when non-inheriting scope has no match Per-directory filter scope evaluation could short-circuit on a synthetic `pattern/**` descendant matcher (compiled for anchored excludes like `- /bar`) and return the inner scope's traversal-mode decision before the outer scope's real user-written rule could fire. Replace the previous `has_matching_rule` helper - which called the public `allows_during_traversal` and `allows_deletion` and so saw the descendant optimisation - with two context-aware predicates that only consider real direct matchers. This mirrors upstream `exclude.c:rule_matches()`, which has no descendant matching at all - descendant exclusion is a side effect of the sender walk not descending into excluded directories. Both the Transfer (`allows`) and Deletion (`allows_deletion`) paths now fall through to outer scopes when the current scope contains no real rule matching the path, and continue to honour protect/risk rules on the deletion side. Add regression coverage that pins the inner-scope descendant fall- through, root-level rule propagation through silent per-dir scopes, `:C`-style non-inheriting scope fall-through, and the symmetric deletion-side behaviour. * fix(filters): forward :C cvs_mode on wire and default empty pattern to .cvsignore PR #5842 fixed the merge-file parser to accept a bare `:C` line by adding `cvs_mode` to `FilterRule`. Two related wire-side gaps still let the upstream `exclude` / `exclude-lsh` testsuite fail when `-f:C -f-C` is invoked over remote shell: - `build_wire_format_rules` ignored the `C` modifier when encoding a DirMerge spec, because `DirMergeOptions` had no dedicated cvs-mode bit. The CLI parsed `:C` correctly, but `cvs_exclude` was always false on the wire, so the remote sender never saw the `C` flag. - `wire_rule_to_dir_merge_config` did not implement upstream `exclude.c:1404-1408`'s "empty pattern defaults to `.cvsignore`" fallback, so a wire rule like `:C ` (cvs_exclude set, no pattern) produced a `DirMergeConfig` with an empty filename and silently disabled per-directory `.cvsignore` lookup. Add a `cvs_mode` field to `DirMergeOptions` with `cvs_mode()` / `is_cvs_mode()` accessors, set it from the CLI `parse_merge_modifiers` `C` branch, forward it as `cvs_exclude=true` in `build_wire_format_rules`, and substitute `.cvsignore` as the default pattern inside `wire_rule_to_dir_merge_config` when the wire rule has cvs_exclude set with no pattern.
This was referenced Jun 17, 2026
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
…ignore (#5842) * fix(filters): parse :C modifier on per-directory merge rules for CVS-ignore When a per-directory merge rule uses the `:C` (or `.C`) short form with an empty pattern, the parser rejected it as "unrecognized filter rule" instead of defaulting the filename to `.cvsignore`, and the `C` (CVS-ignore) modifier was never propagated from `RuleModifiers` onto the resulting `FilterRule`. The wire-format path and the CLI `--filter :C` path already handle this correctly; only merge files read from disk via `parse_rules` (e.g. `mid/.filt`) were affected. This breaks the upstream `merge` and `exclude-lsh` testsuite scenarios (task #4428, UTS-V4.B). Add a `cvs_mode` flag to `FilterRule` with a `with_cvs_mode` builder and `is_cvs_mode` accessor; propagate it through `RuleModifiers::apply`; and in `try_parse_short_form`, when a `:`/`.` rule has empty pattern and the `C` modifier set, default to the filename `.cvsignore`. upstream references (rsync-3.4.4): - exclude.c:1248-1255: `:C` sets FILTRULE_NO_PREFIXES | FILTRULE_WORD_SPLIT | FILTRULE_NO_INHERIT | FILTRULE_CVS_IGNORE. - exclude.c:1324: empty pattern only errors when FILTRULE_CVS_IGNORE is unset. - exclude.c:1404-1408: empty-pattern merge defaults to `.cvsignore`. - testsuite/merge.test, testsuite/exclude-lsh.test:86-88: failing fixtures. * fix(filters): backfill cvs_mode in FilterRule struct literals The :C modifier work added a cvs_mode field to FilterRule but missed the test-side struct literal initializations in crates/filters/src/ compiled/{clear,mod,rule}.rs. The build now fails with E0063 because those literals omit the new field. Add cvs_mode: false to every FilterRule struct literal in those test modules so the field set matches the public struct definition.
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
…5817) * fix(filters): fall through to outer scopes when non-inheriting scope has no match Per-directory filter scope evaluation could short-circuit on a synthetic `pattern/**` descendant matcher (compiled for anchored excludes like `- /bar`) and return the inner scope's traversal-mode decision before the outer scope's real user-written rule could fire. Replace the previous `has_matching_rule` helper - which called the public `allows_during_traversal` and `allows_deletion` and so saw the descendant optimisation - with two context-aware predicates that only consider real direct matchers. This mirrors upstream `exclude.c:rule_matches()`, which has no descendant matching at all - descendant exclusion is a side effect of the sender walk not descending into excluded directories. Both the Transfer (`allows`) and Deletion (`allows_deletion`) paths now fall through to outer scopes when the current scope contains no real rule matching the path, and continue to honour protect/risk rules on the deletion side. Add regression coverage that pins the inner-scope descendant fall- through, root-level rule propagation through silent per-dir scopes, `:C`-style non-inheriting scope fall-through, and the symmetric deletion-side behaviour. * fix(filters): forward :C cvs_mode on wire and default empty pattern to .cvsignore PR #5842 fixed the merge-file parser to accept a bare `:C` line by adding `cvs_mode` to `FilterRule`. Two related wire-side gaps still let the upstream `exclude` / `exclude-lsh` testsuite fail when `-f:C -f-C` is invoked over remote shell: - `build_wire_format_rules` ignored the `C` modifier when encoding a DirMerge spec, because `DirMergeOptions` had no dedicated cvs-mode bit. The CLI parsed `:C` correctly, but `cvs_exclude` was always false on the wire, so the remote sender never saw the `C` flag. - `wire_rule_to_dir_merge_config` did not implement upstream `exclude.c:1404-1408`'s "empty pattern defaults to `.cvsignore`" fallback, so a wire rule like `:C ` (cvs_exclude set, no pattern) produced a `DirMergeConfig` with an empty filename and silently disabled per-directory `.cvsignore` lookup. Add a `cvs_mode` field to `DirMergeOptions` with `cvs_mode()` / `is_cvs_mode()` accessors, set it from the CLI `parse_merge_modifiers` `C` branch, forward it as `cvs_exclude=true` in `build_wire_format_rules`, and substitute `.cvsignore` as the default pattern inside `wire_rule_to_dir_merge_config` when the wire rule has cvs_exclude set with no pattern.
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
When a filter file read from disk (e.g. a
.rsync-filteror per-directorymerge file like
mid/.filt) contains a:C(or.C) directive with anempty pattern, oc-rsync's
filters::parse_rulesparser rejected it asunrecognized filter ruleinstead of defaulting the filename to.cvsignore, and theC(CVS-ignore) modifier was never propagated fromRuleModifiersonto the resultingFilterRule. The wire-format path(
transfer::generator::filters::wire_rule_to_dir_merge_config) and theCLI argv path (
crates/cli/.../parsing/merge.rs) already handle:Ccorrectly; only the merge-file-on-disk path was broken. The failing
upstream
merge.testandexclude-lsh.testscenarios depend on thisshort form. Tracks task #4428 (UTS-V4.B).
Changes
FilterRulegains acvs_mode: boolfield with builderwith_cvs_modeand accessoris_cvs_mode.RuleModifiers::applypropagatescvs_modeonto the rule.try_parse_short_formincrates/filters/src/merge/parse.rsspecial-cases empty pattern with
cvs_modeset onMerge/DirMergeand defaults to
.cvsignore.crates/filters/src/compiled/mod.rsupdated to acceptthe new field via
cvs_mode: _.crates/filters/src/merge/tests.rscover:C\n,:C my.ignore\n, and.C\n.Upstream references
target/interop/upstream-src/rsync-3.4.4/exclude.c:1248-1255--:Csets
FILTRULE_NO_PREFIXES | FILTRULE_WORD_SPLIT | FILTRULE_NO_INHERIT | FILTRULE_CVS_IGNORE.target/interop/upstream-src/rsync-3.4.4/exclude.c:1324-- emptypattern is only an error when
FILTRULE_CVS_IGNOREis unset.target/interop/upstream-src/rsync-3.4.4/exclude.c:1404-1408--empty-pattern merge defaults to
.cvsignore.target/interop/upstream-src/rsync-3.4.4/testsuite/merge.testandtestsuite/exclude-lsh.test:86-88-- failing fixtures.Test plan
cargo fmt --allcargo check -p filters --all-features(clean)merge.testandexclude-lsh.testre-run on Linux hostNotes
Task tracker #4428. Audit document referenced as the spec source.
The pre-existing PR #5817 is orthogonal: it changes the post-load
scope-evaluation path; this PR fixes the pre-load parse path. They
can land independently.