Skip to content

fix(cli): ensure --server receiver creates dest root with --copy-dest (UTS-12.REOPEN) - #5726

Merged
oferchen merged 1 commit into
masterfrom
fix/uts12-reopen-altdest-server-mkdir
Jun 12, 2026
Merged

oferchen merged 1 commit into
masterfrom
fix/uts12-reopen-altdest-server-mkdir

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

  • Drains split-form --copy-dest <path> (and --link-dest, --compare-dest, --files-from, --backup-dir, --temp-dir) in the --server argument parser so the value slot never lands as a positional destination.
  • Captures the value in ServerLongFlags::reference_directories / files_from so the receiver still honours alt-dest semantics. --partial-dir keeps its existing UTS-SLDB branch.
  • Adds regression tests in crates/cli/src/frontend/server/tests.rs (parser fix) and crates/transfer/tests/uts_12_reopen_altdest_server_mkdir.rs (helper materialises the missing dest once the parser hands it the correct path).

Root cause

Upstream options.c::server_options() emits these path-bearing flags as two argv slots via safe_arg("", value) (alt_dest_opt(0) at options.c:2939-2940 et al.). The previous parser only recognised the --flag=value joined form, so the bare form left the basis path in positional_args[0]. setup_transfer then called ensure_dest_root_exists against the already-existing alt-dest basis (returning Ok(false)), so the actual destination root was never created.

The alt-dest interop test running over lsh.sh
(-ave lsh.sh --copy-dest=/alt /src/ host:/dest/) failed with FileNotFoundError: /dest because the test harness ls-lR'd the never-materialised dest.

Constraints honoured

  • Wire-byte parity preserved: the mkdir stays receiver-local; no MSG_* frame is emitted (UTS-2.d.6).
  • Existing UTS-2.d.5 + EDG-DESTROOT.1-5 helper contracts unchanged - the helper itself is untouched, only the dest-path resolution upstream of it is corrected.
  • No clippy waivers; no #[allow(...)] added.
  • No AI/tooling references in any artifact.

Test plan

  • CI: fmt + clippy
  • CI: nextest (stable)
  • CI: Windows / macOS / Linux musl (stable)
  • CI: interop (alt-dest test must now pass over lsh.sh)

@github-actions github-actions Bot added the bug Something isn't working label Jun 12, 2026
oferchen added a commit that referenced this pull request Jun 12, 2026
* chore: fix master fmt drift + filter_map_bool_then clippy lint

Master CI broke on rustfmt 1.88 and clippy 1.88:

1. `crates/cli/src/frontend/server/run.rs:244` - `use fast_io::landlock::{...}`
   collapses to a single line under rustfmt 1.88 (introduced by PR #5724's
   landlock wire-in).
2. `crates/transfer/src/generator/filters.rs:589` - `let split = ...` long-form
   collapses to single-line under rustfmt 1.88.
3. `crates/transfer/src/generator/file_list/mod.rs:267` - rewrite
   `filter_map(|(b, rel)| (b == &entry.base).then(|| rel.clone()))` as the
   equivalent `filter(...).map(...)` pair so clippy 1.88's new
   `filter_map_bool_then` lint stays clean. Behaviour-identical.

Unblocks PRs #5725, #5726, #5727 once they rebase onto this.

* fix: drop extraneous deref in filter predicate

In .filter(), the destructured 'b' is already &PathBuf since iter() yields
&(PathBuf, PathBuf) and filter receives &Self::Item. The extra deref made it
PathBuf, causing E0277 'can't compare PathBuf with &PathBuf'.

* chore(cli): inline format args in --partial-dir test (clippy 1.88)

uninlined_format_args lint denies the build under clippy 1.88.
… (UTS-12.REOPEN)

Upstream `options.c::server_options()` emits `--copy-dest`, `--link-dest`,
`--compare-dest`, `--files-from`, `--backup-dir`, and `--temp-dir` as two
adjacent argv slots via `safe_arg("", value)` (`alt_dest_opt(0)` at
options.c:2939-2940 and the matching per-flag emission sites). The
`--server` argument parser only recognised the joined `--flag=value`
form, so the bare `--copy-dest /path` form left the basis path in
`positional_args[0]`, displacing the actual destination root.

`setup_transfer` reads `config.args.first()` as the dest operand and
calls `ensure_dest_root_exists` with it. With the wrong path, the
pre-flight ran against the already-existing alt-dest basis (returning
`Ok(false)`) and the real destination root was never created. The
alt-dest interop test running over `lsh.sh`
(`-ave lsh.sh --copy-dest=/alt /src/ host:/dest/`) failed with
`FileNotFoundError: /dest` when the test harness ls-lR'd the never-
materialised dest.

`is_two_arg_server_long_flag` enumerates every bare-form path-bearing
flag upstream emits; `parse_server_flag_string_and_args` drains the
value slot so it never lands as a positional, and `parse_server_long_flags`
routes the value into `reference_directories` / `files_from` so the
receiver still honours the alt-dest semantics. `--partial-dir` keeps
its existing branch because it was wired in UTS-SLDB; the new helper
covers the remaining flags without touching that path.

Regression coverage:
- `parse_server_args_handles_split_copy_dest_form` + siblings in
  `crates/cli/src/frontend/server/tests.rs` pin the parser fix.
- `uts_12_reopen_altdest_server_mkdir.rs` in `crates/transfer/tests/`
  drives `ensure_dest_root_exists` with the resolved dest to prove the
  helper materialises the missing root once the parser hands it the
  correct path.

The mkdir stays receiver-local (no MSG_* frame is emitted) so wire-byte
parity with upstream is preserved.
@oferchen
oferchen force-pushed the fix/uts12-reopen-altdest-server-mkdir branch from 1c7e60f to b2f43bb Compare June 12, 2026 01:40
@oferchen
oferchen merged commit f8a715c into master Jun 12, 2026
55 of 68 checks passed
@oferchen
oferchen deleted the fix/uts12-reopen-altdest-server-mkdir branch June 12, 2026 02:26
oferchen added a commit that referenced this pull request Aug 24, 2026
* chore: fix master fmt drift + filter_map_bool_then clippy lint

Master CI broke on rustfmt 1.88 and clippy 1.88:

1. `crates/cli/src/frontend/server/run.rs:244` - `use fast_io::landlock::{...}`
   collapses to a single line under rustfmt 1.88 (introduced by PR #5724's
   landlock wire-in).
2. `crates/transfer/src/generator/filters.rs:589` - `let split = ...` long-form
   collapses to single-line under rustfmt 1.88.
3. `crates/transfer/src/generator/file_list/mod.rs:267` - rewrite
   `filter_map(|(b, rel)| (b == &entry.base).then(|| rel.clone()))` as the
   equivalent `filter(...).map(...)` pair so clippy 1.88's new
   `filter_map_bool_then` lint stays clean. Behaviour-identical.

Unblocks PRs #5725, #5726, #5727 once they rebase onto this.

* fix: drop extraneous deref in filter predicate

In .filter(), the destructured 'b' is already &PathBuf since iter() yields
&(PathBuf, PathBuf) and filter receives &Self::Item. The extra deref made it
PathBuf, causing E0277 'can't compare PathBuf with &PathBuf'.

* chore(cli): inline format args in --partial-dir test (clippy 1.88)

uninlined_format_args lint denies the build under clippy 1.88.
oferchen added a commit that referenced this pull request Aug 24, 2026
… (UTS-12.REOPEN) (#5726)

Upstream `options.c::server_options()` emits `--copy-dest`, `--link-dest`,
`--compare-dest`, `--files-from`, `--backup-dir`, and `--temp-dir` as two
adjacent argv slots via `safe_arg("", value)` (`alt_dest_opt(0)` at
options.c:2939-2940 and the matching per-flag emission sites). The
`--server` argument parser only recognised the joined `--flag=value`
form, so the bare `--copy-dest /path` form left the basis path in
`positional_args[0]`, displacing the actual destination root.

`setup_transfer` reads `config.args.first()` as the dest operand and
calls `ensure_dest_root_exists` with it. With the wrong path, the
pre-flight ran against the already-existing alt-dest basis (returning
`Ok(false)`) and the real destination root was never created. The
alt-dest interop test running over `lsh.sh`
(`-ave lsh.sh --copy-dest=/alt /src/ host:/dest/`) failed with
`FileNotFoundError: /dest` when the test harness ls-lR'd the never-
materialised dest.

`is_two_arg_server_long_flag` enumerates every bare-form path-bearing
flag upstream emits; `parse_server_flag_string_and_args` drains the
value slot so it never lands as a positional, and `parse_server_long_flags`
routes the value into `reference_directories` / `files_from` so the
receiver still honours the alt-dest semantics. `--partial-dir` keeps
its existing branch because it was wired in UTS-SLDB; the new helper
covers the remaining flags without touching that path.

Regression coverage:
- `parse_server_args_handles_split_copy_dest_form` + siblings in
  `crates/cli/src/frontend/server/tests.rs` pin the parser fix.
- `uts_12_reopen_altdest_server_mkdir.rs` in `crates/transfer/tests/`
  drives `ensure_dest_root_exists` with the resolved dest to prove the
  helper materialises the missing root once the parser hands it the
  correct path.

The mkdir stays receiver-local (no MSG_* frame is emitted) so wire-byte
parity with upstream is preserved.
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