Skip to content

fix: implement receiver-side mode-0 sentinel for --delete-missing-args - #5523

Merged
oferchen merged 2 commits into
masterfrom
fix/uts-19f-receiver-mode-0-sentinel
Jun 10, 2026
Merged

oferchen merged 2 commits into
masterfrom
fix/uts-19f-receiver-mode-0-sentinel

Conversation

@oferchen

@oferchen oferchen commented Jun 9, 2026

Copy link
Copy Markdown
Owner

Summary

  • Sender already emits a mode-0 sentinel entry for --delete-missing-args (mirrors upstream flist.c:2254-2258), but the receiver had no matching consumer. The sentinel is neither file, directory, symlink, nor special, so all existing receiver passes silently skipped it - the named destination path survived against an upstream 3.4.3 sender (clean exit, undeleted file).
  • Add process_missing_args_sentinels() in crates/transfer/src/receiver/directory/missing_args.rs mirroring upstream generator.c:1348-1354 (missing_args == 2 && file->mode == 0): iterate the file list once, delete the named destination when it exists, skip any creation for the sentinel entry.
  • Wire the new pass into all three receiver transfer loops (sync.rs, pipelined.rs, pipelined_incremental.rs) between symlink creation and the extraneous-delete sweep.
  • Deletions route through fast_io::unlink_via_sandbox_or_fallback / recursive_unlinkat_via_sandbox_or_fallback, preserving SEC-1.q TOCTOU guarantees and matching the existing sandbox-anchored deletion contract.
  • Guarded on delete_missing_args and dry_run (matches upstream missing_args == 2 and do_xfers checks).

Upstream reference

  • generator.c:1348-1354 - if (missing_args == 2 && file->mode == 0): apply filter list, then delete_item() when statret == 0.
  • flist.c:2254-2258 - sender branch that emits the mode-0 sentinel this handler consumes.

Test plan

  • Receiver consumes a wire-flist mode-0 sentinel and deletes the named destination file; sibling files survive.
  • Mode-0 sentinel is a no-op when --delete-missing-args is off.
  • Mode-0 sentinel naming a missing destination is a clean no-op (mirrors upstream's statret == 0 guard).
  • --dry-run short-circuits the deletion pass.
  • Mode-0 sentinel naming a directory removes it recursively (mirrors delete_item() dispatch on the destination's st_mode).
  • CI: fmt+clippy, nextest (stable), Windows, macOS, Linux musl.

@github-actions github-actions Bot added the bug Something isn't working label Jun 9, 2026
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, but
the receiver had no matching consumer. 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. Against
an upstream rsync 3.4.3 sender, this surfaced as a clean exit (code 0)
with the missing-arg file not deleted at the receiver.

Add a 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.

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.
@oferchen
oferchen force-pushed the fix/uts-19f-receiver-mode-0-sentinel branch from 15c16c7 to 704fa3f Compare June 10, 2026 02:58
@oferchen
oferchen merged commit bcbcfc1 into master Jun 10, 2026
119 of 121 checks passed
@oferchen
oferchen deleted the fix/uts-19f-receiver-mode-0-sentinel branch June 10, 2026 05:14
oferchen added a commit that referenced this pull request Jun 10, 2026
Group PRs #5510, #5516, #5519, #5520, #5523, #5525-#5544 by shared root
cause rather than by Stream bucket. Seven clusters surface; the parser-
stores-string and field-vs-method shadowing clusters cover the largest
share of the series, and the receiver-driver wiring-parity gap explains
the NDX_DEL_STATS goodbye misses in both #5536 and #5542. Includes a
defense-in-depth audit mapping each cluster onto the rust-landlock
ruleset wired at crates/fast_io/src/landlock.rs.

Doc-only; no code paths touched.
oferchen added a commit that referenced this pull request Jun 10, 2026
Group PRs #5510, #5516, #5519, #5520, #5523, #5525-#5544 by shared root
cause rather than by Stream bucket. Seven clusters surface; the parser-
stores-string and field-vs-method shadowing clusters cover the largest
share of the series, and the receiver-driver wiring-parity gap explains
the NDX_DEL_STATS goodbye misses in both #5536 and #5542. Includes a
defense-in-depth audit mapping each cluster onto the rust-landlock
ruleset wired at crates/fast_io/src/landlock.rs.

Doc-only; no code paths 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
#5523)

* fix: implement receiver-side mode-0 sentinel for --delete-missing-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, but
the receiver had no matching consumer. 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. Against
an upstream rsync 3.4.3 sender, this surfaced as a clean exit (code 0)
with the missing-arg file not deleted at the receiver.

Add a 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.

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.

* style: cargo fmt fix
oferchen added a commit that referenced this pull request Aug 24, 2026
Group PRs #5510, #5516, #5519, #5520, #5523, #5525-#5544 by shared root
cause rather than by Stream bucket. Seven clusters surface; the parser-
stores-string and field-vs-method shadowing clusters cover the largest
share of the series, and the receiver-driver wiring-parity gap explains
the NDX_DEL_STATS goodbye misses in both #5536 and #5542. Includes a
defense-in-depth audit mapping each cluster onto the rust-landlock
ruleset wired at crates/fast_io/src/landlock.rs.

Doc-only; no code paths touched.
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