Repository navigation
fix(filters): wire :C cvs_mode + default empty pattern to .cvsignore - #5817
Conversation
|
NACK — testsuite/exclude.test and exclude-lsh.test still show FAIL on this branch. Root cause: Precise fix: in |
912451b to
869c796
Compare
|
Validation failed — converted back to draft. This PR claims to fix upstream testsuite test(s): Latest upstream testsuite run on this PR's head: https://github.com/oferchen/rsync/actions/runs/27635559609/job/81721703883 The workflow check shows SUCCESS only because the job and step are both marked The claimed test still FAILs. Do not re-ready until the per-test log shows PASS for every claimed test, and no other UTS tests regress. |
9be78f0 to
744ef63
Compare
…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.
…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.
744ef63 to
3ba8a27
Compare
`:C` (and `.C`) with empty pattern in a locally-parsed filter file fails with "unrecognized filter rule" because the short-form parser short-circuits on empty pattern before checking the cvs_mode modifier. Upstream `exclude.c:1404-1408` substitutes `.cvsignore` when the merge rule has cvs_mode and an empty pattern. The wire-format path (`wire_rule_to_dir_merge_config`) handles this correctly. The gap is local-only: `RuleModifiers::cvs_mode` is set in the parser but never propagated to `FilterRule`, so consumers that turn parsed dir-merge rules into `DirMergeConfig` lose the signal to call `with_cvs_mode(true)`. Captures the precise parse failure, upstream references, fix spec (4 edits ~140 LoC across filters/cli/engine), and unit test scaffolding. Tracks UTS-V4.B. Distinct from PR #5817 which addresses post-load scope fall-through, not the pre-load parser reject.
…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.
Summary
Closes the upstream
exclude/exclude-lshtestsuite failures triggered by-f:C -f-C --delete-excludedand a per-directorymid/.filtcontaining a bare:Cline. The original PR title (filter scope fall-through) described an intermediate symptom; the actual root causes are in the:Cmodifier parse path and the wire-rule ->DirMergeConfigconversion. This PR is honest about that scope.This PR does not touch
--files-from. That was lumped in incorrectly with the previous title; if there is a real--files-fromissue it will land separately.What this PR does
.filtcontaining:C(now): parser falls through to.cvsignoreinstead of erroring as "unrecognized filter rule", andRuleModifiers::applypropagatescvs_modeonto the resultingFilterRule. Mirrors upstreamexclude.c:1324(allow empty pattern whenFILTRULE_CVS_IGNOREis set) andexclude.c:1404-1408(default to.cvsignore). [PR fix(filters): parse :C modifier on per-directory merge rules for CVS-ignore #5842 already landed this piece on this branch; this PR completes the wire side.]-f:Cover remote shell (now): the CLI parser already maps:Cto aDirMergespec with the right semantics, butbuild_wire_format_ruleshad no way to forward theCmodifier becauseDirMergeOptionsdid not track it. Add acvs_modeflag toDirMergeOptions, set it from the CLIparse_merge_modifiersCbranch, and forward it ascvs_exclude=trueon the wire so the remote sender sees the full:Crule.cvs_exclude=trueand empty pattern (now):wire_rule_to_dir_merge_configsubstitutes.cvsignoreas the default filename instead of producing aDirMergeConfigwith an empty filename that silently disables per-directory.cvsignorelookup. Mirrors upstreamexclude.c:1404-1408.Upstream references
rsync-3.4.4/exclude.c:1248-1255-Cmodifier setsFILTRULE_NO_PREFIXES | FILTRULE_WORD_SPLIT | FILTRULE_NO_INHERIT | FILTRULE_CVS_IGNORE.rsync-3.4.4/exclude.c:1324- empty pattern allowed only whenFILTRULE_CVS_IGNOREis set.rsync-3.4.4/exclude.c:1404-1408- merge/dir-merge with empty pattern defaults to.cvsignore.rsync-3.4.4/testsuite/exclude.test:86-88(andexclude-lsh.testvia symlink) - failing fixture:mid/.filtcontains a bare:Cline; the wrapping run drives-f dir-merge_.filt -f:C -f-C.Scope explicitly NOT in this PR
--files-from(will be addressed in a separate PR if a real regression is identified).869c796b) is preserved; the new commits stack on top of it.Test plan
cargo fmt --all -- --checkexcludeandexclude-lshwire_rule_to_dir_merge_config_empty_pattern_defaults_to_cvsignore(crates/transfer/src/generator/filters.rs) - empty wire pattern withcvs_exclude=true->.cvsignorefilename.dir_merge_cvs_mode_forwards_cvs_exclude_flag(crates/core/src/client/remote/flags.rs) - locally parsed:CDirMerge round-tripscvs_exclude=trueto the wire.dir_merge_options_cvs_mode_round_trip(crates/engine/src/local_copy/filter_program/options.rs) -DirMergeOptions::cvs_modeaccessor pair is stable.parse_merge_modifiers_cvsignoreaugmented withis_cvs_mode()assertion (crates/cli/src/frontend/filter_rules/parsing/merge.rs).:Cparse path remain in place (crates/filters/src/merge/tests.rs).