Repository navigation
fix(cli): CVS !-clear semantics and --from0 filter files - #6708
Merged
Merged
Conversation
#217 CVS `.cvsignore`/$CVSIGNORE `!` handling: mirror upstream parse_rule_tok (exclude.c:1122-1124, 1315-1323). In a NO_PREFIXES CVS list a leading `!` tentatively sets FILTRULE_CLEAR_LIST, but len>1 clears it, so `!foo` is a LITERAL exclude of a file named `!foo` (not a removal of a prior `foo` exclude). A bare `!` (len==1) keeps CLEAR_LIST and pop_filter_list (exclude.c:1399) wipes the WHOLE shared cvs list, including the built-in defaults. Drop the invented remove-pattern path and parse ~/.cvsignore and $CVSIGNORE into the shared accumulator. #218 --from0/eol_nulls for filter files: honor `--from0`/`-0` when reading `--exclude-from`/`--include-from` files so records split on NUL, mirroring parse_filter_file (exclude.c:1501). Embedded newlines become literal pattern bytes. Deferred (fix site outside crates/cli, occupied by other in-flight PRs): #219 CVS :C/-C wire placement and proto>=29 gate live in the wire send/recv path (core build_wire_format_rules). #222 delete-excluded no-prefixes dir-merge elision lives in core apply_implicit_sender_side_for_delete_excluded / build_wire_format_rules.
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
#217 CVS `.cvsignore`/$CVSIGNORE `!` handling: mirror upstream parse_rule_tok (exclude.c:1122-1124, 1315-1323). In a NO_PREFIXES CVS list a leading `!` tentatively sets FILTRULE_CLEAR_LIST, but len>1 clears it, so `!foo` is a LITERAL exclude of a file named `!foo` (not a removal of a prior `foo` exclude). A bare `!` (len==1) keeps CLEAR_LIST and pop_filter_list (exclude.c:1399) wipes the WHOLE shared cvs list, including the built-in defaults. Drop the invented remove-pattern path and parse ~/.cvsignore and $CVSIGNORE into the shared accumulator. #218 --from0/eol_nulls for filter files: honor `--from0`/`-0` when reading `--exclude-from`/`--include-from` files so records split on NUL, mirroring parse_filter_file (exclude.c:1501). Embedded newlines become literal pattern bytes. Deferred (fix site outside crates/cli, occupied by other in-flight PRs): #219 CVS :C/-C wire placement and proto>=29 gate live in the wire send/recv path (core build_wire_format_rules). #222 delete-excluded no-prefixes dir-merge elision lives in core apply_implicit_sender_side_for_delete_excluded / build_wire_format_rules.
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
Two filter-subsystem parity fixes in
crates/cli, matching upstream rsync 3.4.4 (exclude.c). Two related items are deferred because their real fix sites live incrates/core.Done
#217 - CVS
.cvsignore/$CVSIGNORE!handlingMirrors upstream
parse_rule_tok. In aFILTRULE_NO_PREFIXESCVS list, a leading!tentatively setsFILTRULE_CLEAR_LIST(exclude.c:1122-1124), butlen > 1clears it again (exclude.c:1315-1323), so:!foois a literal exclude of a file named!foo(the!stays in the pattern becauseNO_PREFIXESnever advances past it) - not a removal of a priorfooexclude.!(len == 1) keepsFILTRULE_CLEAR_LIST, andpop_filter_list(exclude.c:1399) wipes the whole sharedcvs_filter_list, including the built-indefault_cvsignore()patterns.The previous code invented a
remove_cvs_patternpath (so!foodeleted a prior exclude) and cleared a per-source local buffer (so built-in defaults survived a bare!). Both are removed;~/.cvsignoreand$CVSIGNOREnow parse into the shared accumulator so a bare!wipes the built-ins too.Files:
crates/cli/src/frontend/filter_rules/cvs.rs; integration test intransfer_request_with_filter.rsrewritten to assert the correct wipe-includes-builtins behavior.#218 -
--from0/ eol_nulls for filter FILESUpstream
parse_filter_filesplits on NUL wheneol_nullsis set (exclude.c:1501:if (eol_nulls? !ch : (ch=='\n'||ch=='\r')) break), so-0/--from0makes--exclude-from/--include-fromfiles NUL-delimited. The reader hardcodedread_until(b'\n'). The existing--from0flag is now threaded throughFilterInputs->apply_filters->append_filter_rules_from_files->load_filter_file_patterns->read_filter_patterns, which splits on NUL and treats embedded newlines as literal pattern bytes.Files:
crates/cli/src/frontend/filter_rules/sources.rs,execution/drive/filters.rs,execution/drive/workflow/run.rs,frontend/mod.rs.Deferred (fix site outside crates/cli)
:C/-Cwire placement + proto>=29 gate. Upstream injects:C/-Cinsidesend_filter_list/recv_filter_listwitham_sender/protocol ordering; the client-receiver adds them local-only, never on the wire, and gates:Con proto>=29 (exclude.c:1644-1698). In this codebase the wire send/recv path isbuild_wire_format_rulesincrates/core/src/client/remote/flags.rs(core), not cli. Skipped per scope guard.send_ruleselides a no-prefixes per-dir-merge underdelete_excluded(exclude.c:1609-1612). The logic (apply_implicit_sender_side_for_delete_excludedand the wire elision inbuild_wire_format_rules) is incrates/core/src/client/config/filters.rsandcrates/core/src/client/remote/flags.rs(core), not cli. Skipped per scope guard.Verification
cargo fmt --all -- --check: clean.cargo clippy -p cli --all-features --all-targets --no-deps -- -D warnings: clean.cargo nextest run -p cliover filter/cvs/exclude/include tests: 433 passed.