Skip to content

fix(filters): apply implicit FILTRULE_SENDER_SIDE under --delete-excluded - #5899

Merged
oferchen merged 1 commit into
masterfrom
fix/uts-dd-exclude-4-implicit-sender-side
Jun 17, 2026
Merged

oferchen merged 1 commit into
masterfrom
fix/uts-dd-exclude-4-implicit-sender-side

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

Upstream rsync's exclude.c::add_rule (lines 1330-1332 in rsync-3.4.4) applies an implicit FILTRULE_SENDER_SIDE flag to every include/exclude rule that carries no explicit side modifier when --delete-excluded is active:

/* --delete-excluded turns an un-modified include/exclude into a sender-side rule. */
if (delete_excluded
 && !(rule->rflags & (FILTRULES_SIDES|FILTRULE_MERGE_FILE|FILTRULE_PERDIR_MERGE)))
    rule->rflags |= FILTRULE_SENDER_SIDE;

The flag drives two downstream effects:

  • get_rule_prefix() (exclude.c:1566-1568) emits the s modifier on the wire prefix.
  • send_rules() (exclude.c:1605) marks the rule as LOCAL_RULE on the sender so it is NOT transmitted to the receiver - the sender already applied it locally.

oc-rsync was forwarding bare include/exclude rules as both-sided through compile_filter_program() (engine path) and build_wire_format_rules() (wire path), so a CLI like --delete-excluded --exclude '*.tmp' produced - *.tmp on the wire instead of upstream's -s *.tmp. The receiver still saw the excluded names and (only thanks to the pre-existing allows_deletion_when_excluded_removed workaround in the local-copy decision context) deleted them - but the byte stream diverged from upstream and remote receivers running upstream rsync evaluated the rule differently.

Fix

  • New FilterRuleSpec::apply_implicit_sender_side_for_delete_excluded() mirrors upstream's mask: it fires only on Include/Exclude kinds whose applies_to_sender == applies_to_receiver == true (i.e. no FILTRULES_SIDES bit), clearing the receiver bit so the rule becomes sender-only.
  • compile_filter_program() and build_wire_format_rules() now both take a delete_excluded parameter and apply the implicit flag before producing engine rules or wire bytes.
  • Call sites in run/mod.rs, daemon transfer orchestration, and embedded SSH transfer plumb config.delete_excluded() through.

Tests

  • 5 unit tests in crates/core/src/client/config/filters.rs cover the spec-side mutation: include/exclude kinds get the flag, explicit sender-only / receiver-only rules are untouched, and Protect / Risk / Clear / DirMerge are all skipped (matching upstream's mask exclusions).
  • 7 wire-format tests in crates/core/src/client/remote/flags.rs cover the serialization path, including a wire-byte parity check that asserts build_rule_prefix() emits -s for a bare --exclude '*.tmp' under --delete-excluded (vs - without it), matching upstream rsync 3.4.4's wire output.

Upstream Reference

  • target/interop/upstream-src/rsync-3.4.4/exclude.c:1330-1332 - implicit flag application in add_rule() / parse_filter_str()
  • target/interop/upstream-src/rsync-3.4.4/exclude.c:1566-1568 - s modifier emission in get_rule_prefix()
  • target/interop/upstream-src/rsync-3.4.4/exclude.c:1605-1612 - sender-side elision in send_rules()

UTS-DD-exclude.4

Test plan

  • cargo fmt --all
  • CI: fmt+clippy
  • CI: nextest (stable) full workspace
  • CI: Windows (stable)
  • CI: macOS (stable)
  • CI: Linux musl (stable)
  • CI: Interop with upstream rsync 3.0.9 / 3.1.3 / 3.4.1 / 3.4.2 over local, SSH, and daemon transports

@oferchen
oferchen force-pushed the fix/uts-dd-exclude-4-implicit-sender-side branch from 64cbd65 to 90863ea Compare June 17, 2026 19:29
…uded

Upstream rsync's exclude.c::add_rule (lines 1330-1332) sets an implicit
FILTRULE_SENDER_SIDE flag on every include/exclude rule that lacks an
explicit side modifier when --delete-excluded is active:

    if (delete_excluded
     && !(rule->rflags & (FILTRULES_SIDES|FILTRULE_MERGE_FILE|FILTRULE_PERDIR_MERGE)))
        rule->rflags |= FILTRULE_SENDER_SIDE;

The flag drives get_rule_prefix() (line 1566-1568) to emit an `s` modifier
on the wire and send_rules() (line 1605) to elide the rule from the
receiver's view because it has already been applied locally on the sender.

oc-rsync's CLI filter spec was forwarding bare include/exclude rules as
both-sided to both the engine and the wire serializer, diverging from
upstream's wire bytes for `--delete-excluded --exclude *.tmp` style
inputs.

Apply the implicit flag on FilterRuleSpec before it is compiled into the
engine FilterProgram and before it is serialized to wire format. The
mutation is gated on FilterRuleKind::Include | Exclude only (matching
upstream's FILTRULES_SIDES|FILTRULE_MERGE_FILE|FILTRULE_PERDIR_MERGE
mask) and only fires when both side bits are still at their default
"applies to both" state.

UTS-DD-exclude.4
@oferchen
oferchen force-pushed the fix/uts-dd-exclude-4-implicit-sender-side branch from 90863ea to 023978d Compare June 17, 2026 19:31
@oferchen
oferchen merged commit efe0b3b into master Jun 17, 2026
2 of 6 checks passed
@oferchen
oferchen deleted the fix/uts-dd-exclude-4-implicit-sender-side branch June 17, 2026 19:33
@github-actions github-actions Bot added the bug Something isn't working label Jun 17, 2026
oferchen added a commit that referenced this pull request Jun 17, 2026
Two unrelated breaks landed on master after #5899 and #5902 and now block every PR:

1. `core::client::remote::ssh_transfer` still called `flags::build_wire_format_rules` with one argument after #5899 added a `delete_excluded: bool` parameter (`embedded_ssh_transfer.rs` was updated; the two call sites in `ssh_transfer.rs` were missed). Pass `config.delete_excluded()` to match the wire-format contract.

2. `engine::local_copy::context_impl::transfer` used `Vec::extend(other.drain(..))` instead of `Vec::append(&mut other)` after #5902, which trips `clippy::extend-with-drain` under `-D warnings`. Switch to `append`.

These are minimal mechanical fixes; no behaviour change.
oferchen added a commit that referenced this pull request Jun 17, 2026
Two follow-ups to the daemon listener defaults change:

1. `run_single_listener_loop` slept 500ms (`SIGNAL_CHECK_INTERVAL`)
   between `accept(2)` polls on the non-blocking listener. This was
   masked previously because the dual-stack default sent traffic
   through `run_dual_stack_loop`, which uses a 50ms WouldBlock sleep
   and a 100ms channel `recv_timeout`. Defaulting to IPv4-only single-
   listener surfaced the latency: the cold-start bench saw 496ms per
   client vs 115ms upstream (4.3x ratio, regression threshold 1.5x).
   Lower the single-listener WouldBlock sleep to 50ms so first-
   connection latency is bounded by the same interval as the dual-
   stack path. `SIGNAL_CHECK_INTERVAL` is still honoured for the
   signal-flag inspection at the top of the loop body via
   `check_signals_and_maintain`.

2. `async_ssh_transport.rs` had two more call sites of
   `flags::build_wire_format_rules` left un-updated when #5899 added
   the `delete_excluded: bool` parameter. Pass `config.delete_excluded()`
   to match the other call sites.

No wire/behaviour change; both fixes are mechanical.
oferchen added a commit that referenced this pull request Jun 17, 2026
* fix(engine,core): unblock master CI after #5899 + #5902 regressions

PR #5902 introduced a `clippy::extend-with-drain` lint violation in the
nested dir-merge wiring at transfer.rs:187. PR #5899 widened
`build_wire_format_rules` to take a `delete_excluded: bool` parameter
but missed the SSH push/pull call sites in ssh_transfer.rs (E0061).

Both fail the master fmt+clippy and Build cells, blocking every open PR.

- engine/.../transfer.rs: replace `extend(.drain(..))` with `append(&mut)`.
- core/.../ssh_transfer.rs: pass `config.delete_excluded()` at both call sites.

* fix(core): wire delete_excluded through async_ssh_transport build_*_server_config

* fix(tests): clippy assertions-on-constants + manual-contains lints

- transfer test: wrap compile-time invariants in `const _: () = assert!(...)`
- cli verbose test: use `lines.contains(&"only.txt")` over iter().any()

* fix(tests): convert OsString args to String for find_flag_string helper
oferchen added a commit that referenced this pull request Jun 17, 2026
Two follow-ups to the daemon listener defaults change:

1. `run_single_listener_loop` slept 500ms (`SIGNAL_CHECK_INTERVAL`)
   between `accept(2)` polls on the non-blocking listener. This was
   masked previously because the dual-stack default sent traffic
   through `run_dual_stack_loop`, which uses a 50ms WouldBlock sleep
   and a 100ms channel `recv_timeout`. Defaulting to IPv4-only single-
   listener surfaced the latency: the cold-start bench saw 496ms per
   client vs 115ms upstream (4.3x ratio, regression threshold 1.5x).
   Lower the single-listener WouldBlock sleep to 50ms so first-
   connection latency is bounded by the same interval as the dual-
   stack path. `SIGNAL_CHECK_INTERVAL` is still honoured for the
   signal-flag inspection at the top of the loop body via
   `check_signals_and_maintain`.

2. `async_ssh_transport.rs` had two more call sites of
   `flags::build_wire_format_rules` left un-updated when #5899 added
   the `delete_excluded: bool` parameter. Pass `config.delete_excluded()`
   to match the other call sites.

No wire/behaviour change; both fixes are mechanical.
oferchen added a commit that referenced this pull request Jun 17, 2026
Two changes that combine to make `testsuite/itemize.test` consistent
with upstream rsync's `-i` and `-vv` outputs for the already-linked
hardlink branch:

1. `local_copy::process_links` (block 2a, `is_already_hardlinked`):
   pass `None` for the snapshot's `symlink_target` slot so the `%L`
   placeholder renders to the empty string. Upstream's
   `hlink.c:218-222` calls `itemize(..., ITEM_LOCAL_CHANGE |
   ITEM_XNAME_FOLLOWS, 0, "")` with an empty xname; `log.c:643-654`
   then skips the ` => %s` suffix, producing the `hf$allspace
   foo/extra` row at line 122 of `testsuite/itemize.test`. The
   previously-passed leader path produced a spurious `=> foo/config1`
   trailer on otherwise-uptodate hardlink rows under `-i`. The
   newly-linked branch (block 2b) is unchanged: it still threads the
   leader path so the `=> foo/config1` xname suffix renders for the
   `-iplrH` line-78 golden.

2. Repair `ssh_transfer::run_pull_transfer` /
   `run_push_transfer`: pass `config.delete_excluded()` as the second
   argument to `flags::build_wire_format_rules`. The signature was
   extended in #5899 (FILTRULE_SENDER_SIDE under
   `--delete-excluded`) but these two SSH call sites were not
   updated, leaving master with `error[E0061]: this function takes 2
   arguments but 1 argument was supplied` and blocking
   `upstream-testsuite` (and all other CI cells) at the build step.

Regression coverage:
- `itemize_hardlink_already_linked_omits_arrow_suffix` runs `-plrtH`
  to set up the destination alias and then `-iplrtH` to verify the
  second-pass row carries no `=> leader.bin` trailer.
oferchen added a commit that referenced this pull request Jun 18, 2026
Two follow-ups to the daemon listener defaults change:

1. `run_single_listener_loop` slept 500ms (`SIGNAL_CHECK_INTERVAL`)
   between `accept(2)` polls on the non-blocking listener. This was
   masked previously because the dual-stack default sent traffic
   through `run_dual_stack_loop`, which uses a 50ms WouldBlock sleep
   and a 100ms channel `recv_timeout`. Defaulting to IPv4-only single-
   listener surfaced the latency: the cold-start bench saw 496ms per
   client vs 115ms upstream (4.3x ratio, regression threshold 1.5x).
   Lower the single-listener WouldBlock sleep to 50ms so first-
   connection latency is bounded by the same interval as the dual-
   stack path. `SIGNAL_CHECK_INTERVAL` is still honoured for the
   signal-flag inspection at the top of the loop body via
   `check_signals_and_maintain`.

2. `async_ssh_transport.rs` had two more call sites of
   `flags::build_wire_format_rules` left un-updated when #5899 added
   the `delete_excluded: bool` parameter. Pass `config.delete_excluded()`
   to match the other call sites.

No wire/behaviour change; both fixes are mechanical.
oferchen added a commit that referenced this pull request Jun 18, 2026
Two changes that combine to make `testsuite/itemize.test` consistent
with upstream rsync's `-i` and `-vv` outputs for the already-linked
hardlink branch:

1. `local_copy::process_links` (block 2a, `is_already_hardlinked`):
   pass `None` for the snapshot's `symlink_target` slot so the `%L`
   placeholder renders to the empty string. Upstream's
   `hlink.c:218-222` calls `itemize(..., ITEM_LOCAL_CHANGE |
   ITEM_XNAME_FOLLOWS, 0, "")` with an empty xname; `log.c:643-654`
   then skips the ` => %s` suffix, producing the `hf$allspace
   foo/extra` row at line 122 of `testsuite/itemize.test`. The
   previously-passed leader path produced a spurious `=> foo/config1`
   trailer on otherwise-uptodate hardlink rows under `-i`. The
   newly-linked branch (block 2b) is unchanged: it still threads the
   leader path so the `=> foo/config1` xname suffix renders for the
   `-iplrH` line-78 golden.

2. Repair `ssh_transfer::run_pull_transfer` /
   `run_push_transfer`: pass `config.delete_excluded()` as the second
   argument to `flags::build_wire_format_rules`. The signature was
   extended in #5899 (FILTRULE_SENDER_SIDE under
   `--delete-excluded`) but these two SSH call sites were not
   updated, leaving master with `error[E0061]: this function takes 2
   arguments but 1 argument was supplied` and blocking
   `upstream-testsuite` (and all other CI cells) at the build step.

Regression coverage:
- `itemize_hardlink_already_linked_omits_arrow_suffix` runs `-plrtH`
  to set up the destination alias and then `-iplrtH` to verify the
  second-pass row carries no `=> leader.bin` trailer.
oferchen added a commit that referenced this pull request Jun 18, 2026
Two follow-ups to the daemon listener defaults change:

1. `run_single_listener_loop` slept 500ms (`SIGNAL_CHECK_INTERVAL`)
   between `accept(2)` polls on the non-blocking listener. This was
   masked previously because the dual-stack default sent traffic
   through `run_dual_stack_loop`, which uses a 50ms WouldBlock sleep
   and a 100ms channel `recv_timeout`. Defaulting to IPv4-only single-
   listener surfaced the latency: the cold-start bench saw 496ms per
   client vs 115ms upstream (4.3x ratio, regression threshold 1.5x).
   Lower the single-listener WouldBlock sleep to 50ms so first-
   connection latency is bounded by the same interval as the dual-
   stack path. `SIGNAL_CHECK_INTERVAL` is still honoured for the
   signal-flag inspection at the top of the loop body via
   `check_signals_and_maintain`.

2. `async_ssh_transport.rs` had two more call sites of
   `flags::build_wire_format_rules` left un-updated when #5899 added
   the `delete_excluded: bool` parameter. Pass `config.delete_excluded()`
   to match the other call sites.

No wire/behaviour change; both fixes are mechanical.
oferchen added a commit that referenced this pull request Jun 18, 2026
* fix(daemon): default listener to IPv4-only matching upstream

The default daemon listener used to bind IPv6+IPv4 (dual-stack) and
treat any per-family accept failure as fatal. On GitHub Actions Linux
runners the IPv6 stack is configured but unreachable: `bind(2)` to
`[::]:873` succeeds, but `accept(2)` then returns a non-routable
address family and the daemon exits 10 ("error in socket I/O") even
though the IPv4 listener was healthy. This matched the upstream
testsuite "daemon (exit 10)" CI-only failure pattern documented under
UTS-DD-daemon-exit10.

Mirror upstream `socket.c::open_socket_in` (rsync-3.4.4:402-499)
semantics by:

- Defaulting to IPv4-only when no `--ipv4`/`--ipv6` flag and no
  explicit `--bind` address is given. Matches upstream's
  `default_af_hint = 0` behaviour when the IPv6 stack is configured
  but unreachable.
- Accepting `--ipv4 --ipv6` together as the explicit dual-stack
  opt-in (previously rejected as a CLI conflict). Sets a new
  `dual_stack` flag on `RuntimeOptions` so the accept loop binds one
  socket per family.
- Tolerating per-family `accept(2)` failures in `run_dual_stack_loop`:
  the surviving family keeps serving connections, the failed family
  logs a warning. Only a fatal accept on the last surviving family
  escalates to daemon exit 10.
- Adding `OC_RSYNC_DAEMON_ADDRESS_FAMILY=ipv4|ipv6|both` as a runtime
  override so CI/test fixtures can force a family without rebuilding
  the CLI.

The bind-address conflict path is preserved: `--bind 1.2.3.4 --ipv6`
still errors with "cannot use --ipv6 with an IPv4 bind address".

Per-family bind warnings already existed (`warn_per_family_bind_failure`);
this commit adds the companion `warn_per_family_accept_failure` so
runtime accept regressions are auditable too.

upstream: target/interop/upstream-src/rsync-3.4.4/socket.c
  - open_socket_in:402-499 - family-iteration bind loop
  - start_accept_loop:537+ - per-family `select(2)` survives single
    descriptor failure

Tests:
- runtime_options/tests.rs: --ipv4 --ipv6 enables dual_stack;
  default has dual_stack=false.
- server_runtime/tests.rs: parse_address_family_env accepts ipv4/ipv6/
  both variants; rejects unknown values; warn_per_family_accept_failure
  labels IPv4/IPv6.
- crates/daemon/tests/listener_address_family.rs: live daemon end-to-end
  with default, --ipv6, --ipv4 --ipv6, and OC_RSYNC_DAEMON_ADDRESS_FAMILY
  variants.

Refs: UTS-DD-daemon-exit10.1, UTS-DD-daemon-exit10.2

* fix: lower single-listener accept poll to 50ms; fix async-ssh build

Two follow-ups to the daemon listener defaults change:

1. `run_single_listener_loop` slept 500ms (`SIGNAL_CHECK_INTERVAL`)
   between `accept(2)` polls on the non-blocking listener. This was
   masked previously because the dual-stack default sent traffic
   through `run_dual_stack_loop`, which uses a 50ms WouldBlock sleep
   and a 100ms channel `recv_timeout`. Defaulting to IPv4-only single-
   listener surfaced the latency: the cold-start bench saw 496ms per
   client vs 115ms upstream (4.3x ratio, regression threshold 1.5x).
   Lower the single-listener WouldBlock sleep to 50ms so first-
   connection latency is bounded by the same interval as the dual-
   stack path. `SIGNAL_CHECK_INTERVAL` is still honoured for the
   signal-flag inspection at the top of the loop body via
   `check_signals_and_maintain`.

2. `async_ssh_transport.rs` had two more call sites of
   `flags::build_wire_format_rules` left un-updated when #5899 added
   the `delete_excluded: bool` parameter. Pass `config.delete_excluded()`
   to match the other call sites.

No wire/behaviour change; both fixes are mechanical.

* fix(clippy): drop unused constant; use io::Error::other
oferchen added a commit that referenced this pull request Jun 18, 2026
Two changes that combine to make `testsuite/itemize.test` consistent
with upstream rsync's `-i` and `-vv` outputs for the already-linked
hardlink branch:

1. `local_copy::process_links` (block 2a, `is_already_hardlinked`):
   pass `None` for the snapshot's `symlink_target` slot so the `%L`
   placeholder renders to the empty string. Upstream's
   `hlink.c:218-222` calls `itemize(..., ITEM_LOCAL_CHANGE |
   ITEM_XNAME_FOLLOWS, 0, "")` with an empty xname; `log.c:643-654`
   then skips the ` => %s` suffix, producing the `hf$allspace
   foo/extra` row at line 122 of `testsuite/itemize.test`. The
   previously-passed leader path produced a spurious `=> foo/config1`
   trailer on otherwise-uptodate hardlink rows under `-i`. The
   newly-linked branch (block 2b) is unchanged: it still threads the
   leader path so the `=> foo/config1` xname suffix renders for the
   `-iplrH` line-78 golden.

2. Repair `ssh_transfer::run_pull_transfer` /
   `run_push_transfer`: pass `config.delete_excluded()` as the second
   argument to `flags::build_wire_format_rules`. The signature was
   extended in #5899 (FILTRULE_SENDER_SIDE under
   `--delete-excluded`) but these two SSH call sites were not
   updated, leaving master with `error[E0061]: this function takes 2
   arguments but 1 argument was supplied` and blocking
   `upstream-testsuite` (and all other CI cells) at the build step.

Regression coverage:
- `itemize_hardlink_already_linked_omits_arrow_suffix` runs `-plrtH`
  to set up the destination alias and then `-iplrtH` to verify the
  second-pass row carries no `=> leader.bin` trailer.
oferchen added a commit that referenced this pull request Jun 18, 2026
#5909)

Two changes that combine to make `testsuite/itemize.test` consistent
with upstream rsync's `-i` and `-vv` outputs for the already-linked
hardlink branch:

1. `local_copy::process_links` (block 2a, `is_already_hardlinked`):
   pass `None` for the snapshot's `symlink_target` slot so the `%L`
   placeholder renders to the empty string. Upstream's
   `hlink.c:218-222` calls `itemize(..., ITEM_LOCAL_CHANGE |
   ITEM_XNAME_FOLLOWS, 0, "")` with an empty xname; `log.c:643-654`
   then skips the ` => %s` suffix, producing the `hf$allspace
   foo/extra` row at line 122 of `testsuite/itemize.test`. The
   previously-passed leader path produced a spurious `=> foo/config1`
   trailer on otherwise-uptodate hardlink rows under `-i`. The
   newly-linked branch (block 2b) is unchanged: it still threads the
   leader path so the `=> foo/config1` xname suffix renders for the
   `-iplrH` line-78 golden.

2. Repair `ssh_transfer::run_pull_transfer` /
   `run_push_transfer`: pass `config.delete_excluded()` as the second
   argument to `flags::build_wire_format_rules`. The signature was
   extended in #5899 (FILTRULE_SENDER_SIDE under
   `--delete-excluded`) but these two SSH call sites were not
   updated, leaving master with `error[E0061]: this function takes 2
   arguments but 1 argument was supplied` and blocking
   `upstream-testsuite` (and all other CI cells) at the build step.

Regression coverage:
- `itemize_hardlink_already_linked_omits_arrow_suffix` runs `-plrtH`
  to set up the destination alias and then `-iplrtH` to verify the
  second-pass row carries no `=> leader.bin` trailer.
oferchen added a commit that referenced this pull request Aug 24, 2026
…uded (#5899)

Upstream rsync's exclude.c::add_rule (lines 1330-1332) sets an implicit
FILTRULE_SENDER_SIDE flag on every include/exclude rule that lacks an
explicit side modifier when --delete-excluded is active:

    if (delete_excluded
     && !(rule->rflags & (FILTRULES_SIDES|FILTRULE_MERGE_FILE|FILTRULE_PERDIR_MERGE)))
        rule->rflags |= FILTRULE_SENDER_SIDE;

The flag drives get_rule_prefix() (line 1566-1568) to emit an `s` modifier
on the wire and send_rules() (line 1605) to elide the rule from the
receiver's view because it has already been applied locally on the sender.

oc-rsync's CLI filter spec was forwarding bare include/exclude rules as
both-sided to both the engine and the wire serializer, diverging from
upstream's wire bytes for `--delete-excluded --exclude *.tmp` style
inputs.

Apply the implicit flag on FilterRuleSpec before it is compiled into the
engine FilterProgram and before it is serialized to wire format. The
mutation is gated on FilterRuleKind::Include | Exclude only (matching
upstream's FILTRULES_SIDES|FILTRULE_MERGE_FILE|FILTRULE_PERDIR_MERGE
mask) and only fires when both side bits are still at their default
"applies to both" state.

UTS-DD-exclude.4
oferchen added a commit that referenced this pull request Aug 24, 2026
* fix(engine,core): unblock master CI after #5899 + #5902 regressions

PR #5902 introduced a `clippy::extend-with-drain` lint violation in the
nested dir-merge wiring at transfer.rs:187. PR #5899 widened
`build_wire_format_rules` to take a `delete_excluded: bool` parameter
but missed the SSH push/pull call sites in ssh_transfer.rs (E0061).

Both fail the master fmt+clippy and Build cells, blocking every open PR.

- engine/.../transfer.rs: replace `extend(.drain(..))` with `append(&mut)`.
- core/.../ssh_transfer.rs: pass `config.delete_excluded()` at both call sites.

* fix(core): wire delete_excluded through async_ssh_transport build_*_server_config

* fix(tests): clippy assertions-on-constants + manual-contains lints

- transfer test: wrap compile-time invariants in `const _: () = assert!(...)`
- cli verbose test: use `lines.contains(&"only.txt")` over iter().any()

* fix(tests): convert OsString args to String for find_flag_string helper
oferchen added a commit that referenced this pull request Aug 24, 2026
* fix(daemon): default listener to IPv4-only matching upstream

The default daemon listener used to bind IPv6+IPv4 (dual-stack) and
treat any per-family accept failure as fatal. On GitHub Actions Linux
runners the IPv6 stack is configured but unreachable: `bind(2)` to
`[::]:873` succeeds, but `accept(2)` then returns a non-routable
address family and the daemon exits 10 ("error in socket I/O") even
though the IPv4 listener was healthy. This matched the upstream
testsuite "daemon (exit 10)" CI-only failure pattern documented under
UTS-DD-daemon-exit10.

Mirror upstream `socket.c::open_socket_in` (rsync-3.4.4:402-499)
semantics by:

- Defaulting to IPv4-only when no `--ipv4`/`--ipv6` flag and no
  explicit `--bind` address is given. Matches upstream's
  `default_af_hint = 0` behaviour when the IPv6 stack is configured
  but unreachable.
- Accepting `--ipv4 --ipv6` together as the explicit dual-stack
  opt-in (previously rejected as a CLI conflict). Sets a new
  `dual_stack` flag on `RuntimeOptions` so the accept loop binds one
  socket per family.
- Tolerating per-family `accept(2)` failures in `run_dual_stack_loop`:
  the surviving family keeps serving connections, the failed family
  logs a warning. Only a fatal accept on the last surviving family
  escalates to daemon exit 10.
- Adding `OC_RSYNC_DAEMON_ADDRESS_FAMILY=ipv4|ipv6|both` as a runtime
  override so CI/test fixtures can force a family without rebuilding
  the CLI.

The bind-address conflict path is preserved: `--bind 1.2.3.4 --ipv6`
still errors with "cannot use --ipv6 with an IPv4 bind address".

Per-family bind warnings already existed (`warn_per_family_bind_failure`);
this commit adds the companion `warn_per_family_accept_failure` so
runtime accept regressions are auditable too.

upstream: target/interop/upstream-src/rsync-3.4.4/socket.c
  - open_socket_in:402-499 - family-iteration bind loop
  - start_accept_loop:537+ - per-family `select(2)` survives single
    descriptor failure

Tests:
- runtime_options/tests.rs: --ipv4 --ipv6 enables dual_stack;
  default has dual_stack=false.
- server_runtime/tests.rs: parse_address_family_env accepts ipv4/ipv6/
  both variants; rejects unknown values; warn_per_family_accept_failure
  labels IPv4/IPv6.
- crates/daemon/tests/listener_address_family.rs: live daemon end-to-end
  with default, --ipv6, --ipv4 --ipv6, and OC_RSYNC_DAEMON_ADDRESS_FAMILY
  variants.

Refs: UTS-DD-daemon-exit10.1, UTS-DD-daemon-exit10.2

* fix: lower single-listener accept poll to 50ms; fix async-ssh build

Two follow-ups to the daemon listener defaults change:

1. `run_single_listener_loop` slept 500ms (`SIGNAL_CHECK_INTERVAL`)
   between `accept(2)` polls on the non-blocking listener. This was
   masked previously because the dual-stack default sent traffic
   through `run_dual_stack_loop`, which uses a 50ms WouldBlock sleep
   and a 100ms channel `recv_timeout`. Defaulting to IPv4-only single-
   listener surfaced the latency: the cold-start bench saw 496ms per
   client vs 115ms upstream (4.3x ratio, regression threshold 1.5x).
   Lower the single-listener WouldBlock sleep to 50ms so first-
   connection latency is bounded by the same interval as the dual-
   stack path. `SIGNAL_CHECK_INTERVAL` is still honoured for the
   signal-flag inspection at the top of the loop body via
   `check_signals_and_maintain`.

2. `async_ssh_transport.rs` had two more call sites of
   `flags::build_wire_format_rules` left un-updated when #5899 added
   the `delete_excluded: bool` parameter. Pass `config.delete_excluded()`
   to match the other call sites.

No wire/behaviour change; both fixes are mechanical.

* fix(clippy): drop unused constant; use io::Error::other
oferchen added a commit that referenced this pull request Aug 24, 2026
#5909)

Two changes that combine to make `testsuite/itemize.test` consistent
with upstream rsync's `-i` and `-vv` outputs for the already-linked
hardlink branch:

1. `local_copy::process_links` (block 2a, `is_already_hardlinked`):
   pass `None` for the snapshot's `symlink_target` slot so the `%L`
   placeholder renders to the empty string. Upstream's
   `hlink.c:218-222` calls `itemize(..., ITEM_LOCAL_CHANGE |
   ITEM_XNAME_FOLLOWS, 0, "")` with an empty xname; `log.c:643-654`
   then skips the ` => %s` suffix, producing the `hf$allspace
   foo/extra` row at line 122 of `testsuite/itemize.test`. The
   previously-passed leader path produced a spurious `=> foo/config1`
   trailer on otherwise-uptodate hardlink rows under `-i`. The
   newly-linked branch (block 2b) is unchanged: it still threads the
   leader path so the `=> foo/config1` xname suffix renders for the
   `-iplrH` line-78 golden.

2. Repair `ssh_transfer::run_pull_transfer` /
   `run_push_transfer`: pass `config.delete_excluded()` as the second
   argument to `flags::build_wire_format_rules`. The signature was
   extended in #5899 (FILTRULE_SENDER_SIDE under
   `--delete-excluded`) but these two SSH call sites were not
   updated, leaving master with `error[E0061]: this function takes 2
   arguments but 1 argument was supplied` and blocking
   `upstream-testsuite` (and all other CI cells) at the build step.

Regression coverage:
- `itemize_hardlink_already_linked_omits_arrow_suffix` runs `-plrtH`
  to set up the destination alias and then `-iplrtH` to verify the
  second-pass row carries no `=> leader.bin` trailer.
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