Skip to content

fix: let receiver-side rules protect under --delete-excluded, as upstream - #8258

Merged
oferchen merged 4 commits into
masterfrom
fix/delete-excluded-receiver-rules
Oct 29, 2026
Merged

oferchen merged 4 commits into
masterfrom
fix/delete-excluded-receiver-rules

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

  • --delete-excluded no longer deletes what a receiver-side rule protects. On a pull or push, --filter='-r *.keep' --delete-excluded used to delete every *.keep in the destination; rsync 3.5.1 keeps them. The cause was an oc-only OR-in in FilterChain::allows_deletion: || delete_excluded && allows_deletion_when_excluded_removed. It let --delete-excluded override any exclude, whatever side the rule was on. The OR-in is removed.
  • upstream: rule_matches() has no delete_excluded term. The flag acts in exactly one place, exclude.c:1479-1481 parse_rule_tok(), which turns an un-modified include/exclude into a sender-side rule as it is parsed, so the receiver ignores it. oc already mirrors that at both parse sites: command-line rules in core flags.rs (apply_implicit_sender_side_for_delete_excluded), and per-directory merge-file rules in filters apply_merge_implicit_sender_side. With the OR-in gone, each is the only mechanism for its rule source.
  • New e2e test crates/transfer/tests/inc_recurse_pull_delete_excluded.rs covers the per-segment incremental-recursion delete (delete_in_segment) across 12 directories. It has five cells: a command-line exclude with and without --delete-excluded, a -r rule under --delete-excluded, and a destination .rsync-filter dir-merge with and without it. Each cell also asserts that every source file arrives and that unrelated extraneous files are deleted.

Known, not fixed here: a LOCAL copy has the same bug. rsync -r --delete --filter='-r *.keep' --delete-excluded src/ dest/ keeps the file on 3.5.1 but deletes it on oc. The engine's local filter program carries its own copy of the OR-in as its only --delete-excluded mechanism. That code is replaced when the two filter matchers are consolidated (task 480), and this cell is that work's first proof.

Test plan

  • Oracle vs rsync 3.5.1 on the same 12-dir tree. The pull and push columns are oc after this change; before it, oc's -r rule, --delete-excluded cell was 0.
Cell 3.5.1 oc pull oc push
--exclude=*.tmp --delete-excluded 0 left 0 0
--exclude=*.tmp 12 kept 12 12
-r *.keep --delete-excluded 12 kept 12 12
-r *.keep 12 kept 12 12
: .rsync-filter --delete-excluded 0 left 0 0
: .rsync-filter 12 kept 12 12
  • Single-point mutation checks, each restored with git afterwards; lsh-stub present and SKIP lines grepped, so no cell passed vacuously:
    • OR-in restored: only the -r cell fails.
    • flags.rs command-line sender-side marking disabled: only the command-line exclude cell fails.
    • apply_merge_implicit_sender_side disabled: only the dir-merge cell fails.
    • Restored: 5/5 pass.
  • nextest -p filters -p transfer -p core --all-features: 7817 passed, 0 failed, 64 skipped.
  • fmt, check_rustfmt_all.py, workspace clippy --all-targets --all-features, no-default clippy for filters and transfer, windows-gnu cargo check -p filters -p transfer --all-features --tests, unsafe_owner_deps.py, dead_code_census.py, xtask no-placeholders.

Coordination

  • Related PRs / issues: follows the released-segment directory-mtime test PR for the same epic. The local-copy half is tracked by task 480.
  • Depends on: none.
  • Blocked by: none.

Conventional commit prefix

  • fix:

Pre-merge checklist

  • Conventional commit prefix on PR title matches the change category.
  • cargo fmt --all run locally.
  • CHANGELOG.md updated (Fixed / Data integrity, #PRNUM to be filled).
  • No references to internal tooling or non-human authoring aids; hyphens, not em-dashes.

Carries the session_fork.rs fix from #8253 so this branch's macOS jobs stop
failing on the master test-harness race: on EPERM for our own child, SIGKILL
the leader before a blocking WNOWAIT wait, and accept a setpgid refusal when the
child already leads its own group. The content is identical to #8253, so the
two merge without conflict.
@oferchen
oferchen merged commit 17f80c6 into master Oct 29, 2026
85 of 86 checks passed
@oferchen
oferchen deleted the fix/delete-excluded-receiver-rules branch October 29, 2026 07:31
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