Skip to content

fix: wire delete pass into pipelined_incremental for NDX_DEL_STATS (URV-6.b) - #5541

Merged
oferchen merged 1 commit into
masterfrom
fix/urv-6b-incremental-delete-wiring
Jun 10, 2026
Merged

oferchen merged 1 commit into
masterfrom
fix/urv-6b-incremental-delete-wiring

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

  • The incremental-flist receive driver (run_pipelined_incremental, default-on) skipped delete_extraneous_files entirely. DeleteStats never populated, so NDX_DEL_STATS could not carry real counters during goodbye in the default code path.
  • Mirrors the existing delete-pass wiring in run_pipelined: when flags.delete is set, the destination is swept after symlink creation and before building the candidate transfer list. Per-type counters now propagate to TransferStats.delete_stats and delete_limit_exceeded, accumulating globally like upstream.
  • Wire format and oc-rsync features are untouched: no protocol changes, no impact on parallel-receive-delta, flat-flist, or branding.

Upstream Reference

  • generator.c:do_delete_pass() - full tree walk deletion sweep
  • generator.c:2376-2381 - early write_del_stats() path
  • generator.c:2420-2425 - late write_del_stats() path
  • main.c:225-238 - write_del_stats() wire format

Test plan

  • Added incremental_driver_populates_delete_stats regression test in tests/file_list/incremental_directories.rs (gated on incremental-flist) that:
    • Builds a receiver configured the same way run_pipelined_incremental would (delete flag, destination args, populated flist).
    • Creates a destination with extraneous files plus one kept entry.
    • Calls the delete pass through the same surface the driver now uses.
    • Asserts TransferStats.delete_stats.files == 2, total() >= 2, the extraneous files are gone, and the kept file survives.
  • CI: fmt+clippy, nextest (stable), Windows, macOS, Linux musl, interop.

Coordination

The gate (flags.delete) mirrors the existing call site in pipelined.rs verbatim, so URV-6.a can sweep both drivers in a single follow-up. Wire emission of NDX_DEL_STATS from the receiver's goodbye depends on #5536; once that lands, both drivers will emit the message via the same pending_del_stats stash.

@github-actions github-actions Bot added the bug Something isn't working label Jun 10, 2026
…RV-6.b)

The incremental-flist receive driver skipped delete_extraneous_files
entirely, so DeleteStats stayed zero on every default-feature build
and NDX_DEL_STATS never carried real counters during goodbye.

Mirrors the existing delete-pass wiring in run_pipelined: when
flags.delete is set, sweep the destination after symlink creation
and before building the candidate transfer list, then surface the
per-type counters via TransferStats.delete_stats and
delete_limit_exceeded.

Adds a regression test that configures the receiver the same way the
incremental driver does and asserts the swept counters propagate to
TransferStats.

upstream: generator.c:do_delete_pass()
@oferchen
oferchen force-pushed the fix/urv-6b-incremental-delete-wiring branch from 27057af to 94e7e83 Compare June 10, 2026 09:13
@oferchen
oferchen merged commit d69254a into master Jun 10, 2026
10 of 22 checks passed
@oferchen
oferchen deleted the fix/urv-6b-incremental-delete-wiring branch June 10, 2026 09:25
oferchen added a commit that referenced this pull request Jun 10, 2026
… path (#5561)

PR #5541 removed receiver/directory/missing_args.rs and its callers in
pipelined.rs and sync.rs, but the call site in pipelined_incremental.rs
was left behind. Master no longer compiles: E0599 "no method named
process_missing_args_sentinels found for &mut ReceiverContext" at
crates/transfer/src/receiver/transfer/pipelined_incremental.rs:94.

Drop the orphan call to restore master compilation. The mode-0 sentinel
handling stays removed in all three receiver drivers, matching the
intent of the original cleanup.
oferchen added a commit that referenced this pull request Jun 10, 2026
UTS-1.e (`docs/audits/uts-1-e-test6-actual-command.md`): document the
upstream `testsuite/00-hello.test` test6 command that lsh.sh forwards
to oc-rsync (`--server --sender -logDtpre.iLsfxCIvu --old-args .
'one two'`), capture the verbatim failure from
`target/interop/upstream-testsuite/00-hello.log:139-141`, and trace
the receiver-side `zero-length filename` error to a missing server-
side `--old-args` re-split (upstream `options.c:1640-1648`). Includes
two follow-up items.

UTS-1.f (`docs/audits/uts-1-f-tcpdump-wire-parity.md`): walk the
`-ais` wire-byte layout for push and pull through lsh.sh. The
symmetric oc-rsync<->oc-rsync legs (test4/test5) show PARITY, with
the drain layer matching upstream `io.c:1308-1367` byte-for-byte and
locked by PR #5610's regression test. The asymmetric upstream-client
-> oc-rsync-server legs are a GAP_FOUND because PR #5541's rebase
diff silently reverted PR #5516's cmdline+stdin merge in
`crates/cli/src/frontend/server/run.rs`. The drain test from #5610
remains valid; the merge fix needs to be reapplied. Includes three
follow-up items.

Both docs cross-reference PR #5516, PR #5610, PR #5541, the upstream
3.4.4 source at `target/interop/upstream-src/rsync-3.4.4/`, and the
captured fixture log at
`target/interop/upstream-testsuite/00-hello.log`.

No production code changes. No oc-rsync-specific feature impact. No
branding touched.
oferchen added a commit that referenced this pull request Jun 11, 2026
…sing-args

The sender side already emits a mode-0 sentinel file-list entry per
upstream flist.c:2254-2258 when --delete-missing-args is in effect.
PR #5523 added the matching receiver consumer, but PR #5541 (merged
four hours later from a branch that pre-dated #5523) inadvertently
deleted both `missing_args.rs` and its wire-up in the receiver
transfer paths.

Mode-0 entries are neither file, directory, symlink, nor special, so
the existing create/transfer passes silently skip them, leaving the
named destination path untouched. The upstream testsuite test
`delete-missing-args-files-from` (issue #910) surfaces this as
"missing-arg file ghost.txt was not deleted on the receiver" with a
clean exit code 0.

Restore the dedicated handler that mirrors upstream
generator.c:1348-1354 (missing_args == 2 && file->mode == 0):
iterate the file list once after directory/symlink creation but before
the extraneous-delete sweep, remove the named destination path when it
exists, and skip any further creation for that entry. Deletions route
through the existing sandbox helpers (unlink_via_sandbox_or_fallback /
recursive_unlinkat_via_sandbox_or_fallback) so the SEC-1.q TOCTOU
guarantees still apply. dry_run and the absence of
--delete-missing-args short-circuit the pass, matching upstream's
statret guard and missing_args mode check.

Wired into all three receiver transfer drivers (`run_pipelined`,
`run_pipelined_incremental`, and `run_sync`) so the handler runs
regardless of feature flags or fallback path.

Regression coverage exercises the receiver against a real on-disk
destination through both the wire-flist consume path
(receive_file_list) and direct file_list construction, covering: file
deletion, directory recursive removal, missing-destination no-op,
dry-run skip, and the no-op when --delete-missing-args is off.

upstream: generator.c:1348-1354 missing_args == 2 && file->mode == 0
upstream: flist.c:2254-2258 sender mode-0 sentinel emission
oferchen added a commit that referenced this pull request Jun 11, 2026
…sing-args

The sender side already emits a mode-0 sentinel file-list entry per
upstream flist.c:2254-2258 when --delete-missing-args is in effect.
PR #5523 added the matching receiver consumer, but PR #5541 (merged
four hours later from a branch that pre-dated #5523) inadvertently
deleted both `missing_args.rs` and its wire-up in the receiver
transfer paths.

Mode-0 entries are neither file, directory, symlink, nor special, so
the existing create/transfer passes silently skip them, leaving the
named destination path untouched. The upstream testsuite test
`delete-missing-args-files-from` (issue #910) surfaces this as
"missing-arg file ghost.txt was not deleted on the receiver" with a
clean exit code 0.

Restore the dedicated handler that mirrors upstream
generator.c:1348-1354 (missing_args == 2 && file->mode == 0):
iterate the file list once after directory/symlink creation but before
the extraneous-delete sweep, remove the named destination path when it
exists, and skip any further creation for that entry. Deletions route
through the existing sandbox helpers (unlink_via_sandbox_or_fallback /
recursive_unlinkat_via_sandbox_or_fallback) so the SEC-1.q TOCTOU
guarantees still apply. dry_run and the absence of
--delete-missing-args short-circuit the pass, matching upstream's
statret guard and missing_args mode check.

Wired into all three receiver transfer drivers (`run_pipelined`,
`run_pipelined_incremental`, and `run_sync`) so the handler runs
regardless of feature flags or fallback path.

Regression coverage exercises the receiver against a real on-disk
destination through both the wire-flist consume path
(receive_file_list) and direct file_list construction, covering: file
deletion, directory recursive removal, missing-destination no-op,
dry-run skip, and the no-op when --delete-missing-args is off.

upstream: generator.c:1348-1354 missing_args == 2 && file->mode == 0
upstream: flist.c:2254-2258 sender mode-0 sentinel emission
oferchen added a commit that referenced this pull request Jun 11, 2026
…sing-args

The sender side already emits a mode-0 sentinel file-list entry per
upstream flist.c:2254-2258 when --delete-missing-args is in effect.
PR #5523 added the matching receiver consumer, but PR #5541 (merged
four hours later from a branch that pre-dated #5523) inadvertently
deleted both `missing_args.rs` and its wire-up in the receiver
transfer paths.

Mode-0 entries are neither file, directory, symlink, nor special, so
the existing create/transfer passes silently skip them, leaving the
named destination path untouched. The upstream testsuite test
`delete-missing-args-files-from` (issue #910) surfaces this as
"missing-arg file ghost.txt was not deleted on the receiver" with a
clean exit code 0.

Restore the dedicated handler that mirrors upstream
generator.c:1348-1354 (missing_args == 2 && file->mode == 0):
iterate the file list once after directory/symlink creation but before
the extraneous-delete sweep, remove the named destination path when it
exists, and skip any further creation for that entry. Deletions route
through the existing sandbox helpers (unlink_via_sandbox_or_fallback /
recursive_unlinkat_via_sandbox_or_fallback) so the SEC-1.q TOCTOU
guarantees still apply. dry_run and the absence of
--delete-missing-args short-circuit the pass, matching upstream's
statret guard and missing_args mode check.

Wired into all three receiver transfer drivers (`run_pipelined`,
`run_pipelined_incremental`, and `run_sync`) so the handler runs
regardless of feature flags or fallback path.

Regression coverage exercises the receiver against a real on-disk
destination through both the wire-flist consume path
(receive_file_list) and direct file_list construction, covering: file
deletion, directory recursive removal, missing-destination no-op,
dry-run skip, and the no-op when --delete-missing-args is off.

upstream: generator.c:1348-1354 missing_args == 2 && file->mode == 0
upstream: flist.c:2254-2258 sender mode-0 sentinel emission
oferchen added a commit that referenced this pull request Jun 11, 2026
…sing-args (#5681)

The sender side already emits a mode-0 sentinel file-list entry per
upstream flist.c:2254-2258 when --delete-missing-args is in effect.
PR #5523 added the matching receiver consumer, but PR #5541 (merged
four hours later from a branch that pre-dated #5523) inadvertently
deleted both `missing_args.rs` and its wire-up in the receiver
transfer paths.

Mode-0 entries are neither file, directory, symlink, nor special, so
the existing create/transfer passes silently skip them, leaving the
named destination path untouched. The upstream testsuite test
`delete-missing-args-files-from` (issue #910) surfaces this as
"missing-arg file ghost.txt was not deleted on the receiver" with a
clean exit code 0.

Restore the dedicated handler that mirrors upstream
generator.c:1348-1354 (missing_args == 2 && file->mode == 0):
iterate the file list once after directory/symlink creation but before
the extraneous-delete sweep, remove the named destination path when it
exists, and skip any further creation for that entry. Deletions route
through the existing sandbox helpers (unlink_via_sandbox_or_fallback /
recursive_unlinkat_via_sandbox_or_fallback) so the SEC-1.q TOCTOU
guarantees still apply. dry_run and the absence of
--delete-missing-args short-circuit the pass, matching upstream's
statret guard and missing_args mode check.

Wired into all three receiver transfer drivers (`run_pipelined`,
`run_pipelined_incremental`, and `run_sync`) so the handler runs
regardless of feature flags or fallback path.

Regression coverage exercises the receiver against a real on-disk
destination through both the wire-flist consume path
(receive_file_list) and direct file_list construction, covering: file
deletion, directory recursive removal, missing-destination no-op,
dry-run skip, and the no-op when --delete-missing-args is off.

upstream: generator.c:1348-1354 missing_args == 2 && file->mode == 0
upstream: flist.c:2254-2258 sender mode-0 sentinel emission
oferchen added a commit that referenced this pull request Aug 24, 2026
…RV-6.b) (#5541)

The incremental-flist receive driver skipped delete_extraneous_files
entirely, so DeleteStats stayed zero on every default-feature build
and NDX_DEL_STATS never carried real counters during goodbye.

Mirrors the existing delete-pass wiring in run_pipelined: when
flags.delete is set, sweep the destination after symlink creation
and before building the candidate transfer list, then surface the
per-type counters via TransferStats.delete_stats and
delete_limit_exceeded.

Adds a regression test that configures the receiver the same way the
incremental driver does and asserts the swept counters propagate to
TransferStats.

upstream: generator.c:do_delete_pass()
oferchen added a commit that referenced this pull request Aug 24, 2026
… path (#5561)

PR #5541 removed receiver/directory/missing_args.rs and its callers in
pipelined.rs and sync.rs, but the call site in pipelined_incremental.rs
was left behind. Master no longer compiles: E0599 "no method named
process_missing_args_sentinels found for &mut ReceiverContext" at
crates/transfer/src/receiver/transfer/pipelined_incremental.rs:94.

Drop the orphan call to restore master compilation. The mode-0 sentinel
handling stays removed in all three receiver drivers, matching the
intent of the original cleanup.
oferchen added a commit that referenced this pull request Aug 24, 2026
UTS-1.e (`docs/audits/uts-1-e-test6-actual-command.md`): document the
upstream `testsuite/00-hello.test` test6 command that lsh.sh forwards
to oc-rsync (`--server --sender -logDtpre.iLsfxCIvu --old-args .
'one two'`), capture the verbatim failure from
`target/interop/upstream-testsuite/00-hello.log:139-141`, and trace
the receiver-side `zero-length filename` error to a missing server-
side `--old-args` re-split (upstream `options.c:1640-1648`). Includes
two follow-up items.

UTS-1.f (`docs/audits/uts-1-f-tcpdump-wire-parity.md`): walk the
`-ais` wire-byte layout for push and pull through lsh.sh. The
symmetric oc-rsync<->oc-rsync legs (test4/test5) show PARITY, with
the drain layer matching upstream `io.c:1308-1367` byte-for-byte and
locked by PR #5610's regression test. The asymmetric upstream-client
-> oc-rsync-server legs are a GAP_FOUND because PR #5541's rebase
diff silently reverted PR #5516's cmdline+stdin merge in
`crates/cli/src/frontend/server/run.rs`. The drain test from #5610
remains valid; the merge fix needs to be reapplied. Includes three
follow-up items.

Both docs cross-reference PR #5516, PR #5610, PR #5541, the upstream
3.4.4 source at `target/interop/upstream-src/rsync-3.4.4/`, and the
captured fixture log at
`target/interop/upstream-testsuite/00-hello.log`.

No production code changes. No oc-rsync-specific feature impact. No
branding touched.
oferchen added a commit that referenced this pull request Aug 24, 2026
When the upstream rsync client uses --secluded-args / -s, it splits its
argv: the server-options head (--server, --sender, packed flag string,
value-bearing long flags) travels on the command line, while the trailing
positional args (the dot separator and path arguments) stream over stdin
as NUL-delimited bytes. PR #5516 wired the merge into run_server_mode so
both sources combine into the effective argv before flag parsing. PR #5541
(URV-6.b NDX_DEL_STATS wiring) inadvertently reverted that merge along
with the regression tests, restoring the prior behaviour of replacing
effective_args with the stdin payload alone.

The regression discards the cmdline tail. Against an upstream client that
sets -s, the server loses the packed flag string entirely and aborts with
"invalid server arguments: missing rsync server flag string". The
00-hello suite kept passing because test4/test5 run oc-rsync on both ends
and the symmetric client buries the full arg list inside the stdin
payload.

Restore the merge contract from PR #5516: skip the synthetic "rsync" arg0
the wire prepends and prepend args[1..] (the command-line tail) before
the remaining stdin args. Re-add the two PR #5516 regression tests
covering both the packed -slogDtpre.iLsfxCIvu form and the standalone -s
spelling.

upstream: main.c::read_args() merges cmdline args with stdin args under
--protect-args / secluded-args (main.c:1852 callsite, io.c:1308
read_args(), rsync.c:283 send_protected_args(), options.c:2745 NULL
split). Documented in the UTS-1.e+.f audit (#5631).
oferchen added a commit that referenced this pull request Aug 24, 2026
…sing-args (#5681)

The sender side already emits a mode-0 sentinel file-list entry per
upstream flist.c:2254-2258 when --delete-missing-args is in effect.
PR #5523 added the matching receiver consumer, but PR #5541 (merged
four hours later from a branch that pre-dated #5523) inadvertently
deleted both `missing_args.rs` and its wire-up in the receiver
transfer paths.

Mode-0 entries are neither file, directory, symlink, nor special, so
the existing create/transfer passes silently skip them, leaving the
named destination path untouched. The upstream testsuite test
`delete-missing-args-files-from` (issue #910) surfaces this as
"missing-arg file ghost.txt was not deleted on the receiver" with a
clean exit code 0.

Restore the dedicated handler that mirrors upstream
generator.c:1348-1354 (missing_args == 2 && file->mode == 0):
iterate the file list once after directory/symlink creation but before
the extraneous-delete sweep, remove the named destination path when it
exists, and skip any further creation for that entry. Deletions route
through the existing sandbox helpers (unlink_via_sandbox_or_fallback /
recursive_unlinkat_via_sandbox_or_fallback) so the SEC-1.q TOCTOU
guarantees still apply. dry_run and the absence of
--delete-missing-args short-circuit the pass, matching upstream's
statret guard and missing_args mode check.

Wired into all three receiver transfer drivers (`run_pipelined`,
`run_pipelined_incremental`, and `run_sync`) so the handler runs
regardless of feature flags or fallback path.

Regression coverage exercises the receiver against a real on-disk
destination through both the wire-flist consume path
(receive_file_list) and direct file_list construction, covering: file
deletion, directory recursive removal, missing-destination no-op,
dry-run skip, and the no-op when --delete-missing-args is off.

upstream: generator.c:1348-1354 missing_args == 2 && file->mode == 0
upstream: flist.c:2254-2258 sender mode-0 sentinel emission
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