Skip to content

fix(transfer): keep --files-from entries relative under SSH push - #5907

Merged
oferchen merged 3 commits into
masterfrom
fix/uts-files-from-ssh-push-relative
Jun 18, 2026
Merged

oferchen merged 3 commits into
masterfrom
fix/uts-files-from-ssh-push-relative

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

  • SSH-push's build_server_config_for_generator no longer leaves files_from_path empty on the local sender. With --files-from active, the generator now reads filenames from the local list (or the forwarded wire stream for remote files-from) instead of recursing the absolute source operand and mirroring its absolute path on the destination under implied --relative.
  • RemoteInvocationBuilder now matches upstream's options.c:2962 gate: PUSH with a local list omits --files-from to the remote receiver; PULL still forwards --files-from=- --from0 and the local list bytes over the wire (parity with the daemon path).
  • Embedded SSH transport gets the same wiring on both push and pull.

Root cause

The CI upstream-testsuite run https://github.com/oferchen/rsync/actions/runs/27711564454 (files-from.log) showed invocation 2 of testsuite/files-from.test:

oc-rsync -avse lsh.sh --rsync-path=oc-rsync --files-from=$scratchdir/filelist $scratchdir localhost:.../to/

producing destination paths like

./home/runner/work/rsync/rsync/target/interop/upstream-testsuite/scratch/files-from/

instead of the listed ./dir, ./empty, ./emptydir, ... The local mode invocation 1 passed because the CLI workflow's local-only branch already prefixes file_list_operands with /./ markers. The SSH-push branch dropped those operands and never propagated --files-from to the local sender's ServerConfig, so the generator walked the absolute $scratchdir and emitted absolute-prefixed wire names. Upstream's behaviour is documented at flist.c:2275-2298 send_file_list, options.c:2962-2974, and main.c:1191-1198,1322-1328,1372-1375.

Test plan

  • crates/core/src/client/remote/ssh_transfer.rs::tests - new unit tests pin files_from_path propagation for LocalFile, Stdin, RemoteFile, and the disabled case.
  • crates/core/src/client/remote/invocation/tests.rs - new unit tests pin the remote --files-from arg across PUSH/PULL x local/remote.
  • crates/transfer/tests/uts_files_from_ssh_push_relative.rs - new integration test drives the generator's resolve_files_from_paths + build_file_list_with_base pipeline against the upstream files-from.test source layout and asserts the wire-side file list never embeds the absolute source path.
  • CI Upstream Testsuite job runs files-from.test to completion.
  • CI required matrices: fmt+clippy, nextest (stable), Windows, macOS, Linux musl.

@github-actions github-actions Bot added the bug Something isn't working label Jun 17, 2026
@oferchen
oferchen force-pushed the fix/uts-files-from-ssh-push-relative branch 2 times, most recently from 27d8fd3 to bbea958 Compare June 18, 2026 03:02
oferchen added 3 commits June 18, 2026 07:14
The SSH-push path's `build_server_config_for_generator` left
`files_from_path` empty on the local sender's ServerConfig. The
generator then fell through to `build_file_list(paths)` and walked the
absolute source operand recursively. With `--files-from` active the
remote receiver applies implied `--relative`, so the wire-side absolute
names were mirrored on the destination - the upstream
testsuite's `files-from.test` invocation 2 produced
`./home/runner/work/rsync/rsync/target/interop/upstream-testsuite/...`
instead of the listed `./dir`, `./empty`, `./emptydir`, etc.

Wire the local sender's generator to the local `--files-from` source
(Stdin, LocalFile, or forwarded-from-wire for RemoteFile), mirroring
upstream's `options.c:2473,2501` and `main.c:1322-1328`. The generator
now reads filenames from the list, applies the `/./ ` anchor split, and
emits wire-side relative names. Also fix the remote-arg builder to
match upstream's `options.c:2962` gate
`if (files_from && (!am_sender || filesfrom_host))`: PUSH with a local
list must NOT forward `--files-from=-` to the remote receiver. SSH
pull's `--files-from=- --from0` forwarding is wired symmetrically by
reading the local list and forwarding its bytes via
`server_config.connection.files_from_data`, matching daemon pull.
The same wiring is applied to the embedded-ssh transport.

The shared helper for serializing a local files-from source into the
wire format is moved to `client::remote::files_from_forwarding` and
re-exported from `daemon_transfer::orchestration::transfer` to keep
the existing daemon test surface intact.

Tests:

- Unit tests in `crates/core/src/client/remote/ssh_transfer.rs::tests`
  pin `files_from_path` propagation for each `FilesFromSource` variant.
- Unit tests in `crates/core/src/client/remote/invocation/tests.rs`
  pin the remote `--files-from` arg for each PUSH/PULL x local/remote
  combination.
- New integration test in
  `crates/transfer/tests/uts_files_from_ssh_push_relative.rs` drives
  the generator's `resolve_files_from_paths` + `build_file_list_with_base`
  pipeline against the upstream files-from.test source layout and
  asserts the wire-side file list never embeds the absolute source path.

Refs upstream `flist.c:2275-2298 send_file_list`, `options.c:2962-2974`,
`main.c:1191-1198,1322-1328,1372-1375`.
@oferchen
oferchen force-pushed the fix/uts-files-from-ssh-push-relative branch from 38a9d00 to 8e0dcf2 Compare June 18, 2026 04:14
@oferchen
oferchen merged commit c570658 into master Jun 18, 2026
0 of 5 checks passed
@oferchen
oferchen deleted the fix/uts-files-from-ssh-push-relative branch June 18, 2026 04:16
oferchen added a commit that referenced this pull request Aug 24, 2026
* fix(transfer): keep --files-from entries relative under SSH push

The SSH-push path's `build_server_config_for_generator` left
`files_from_path` empty on the local sender's ServerConfig. The
generator then fell through to `build_file_list(paths)` and walked the
absolute source operand recursively. With `--files-from` active the
remote receiver applies implied `--relative`, so the wire-side absolute
names were mirrored on the destination - the upstream
testsuite's `files-from.test` invocation 2 produced
`./home/runner/work/rsync/rsync/target/interop/upstream-testsuite/...`
instead of the listed `./dir`, `./empty`, `./emptydir`, etc.

Wire the local sender's generator to the local `--files-from` source
(Stdin, LocalFile, or forwarded-from-wire for RemoteFile), mirroring
upstream's `options.c:2473,2501` and `main.c:1322-1328`. The generator
now reads filenames from the list, applies the `/./ ` anchor split, and
emits wire-side relative names. Also fix the remote-arg builder to
match upstream's `options.c:2962` gate
`if (files_from && (!am_sender || filesfrom_host))`: PUSH with a local
list must NOT forward `--files-from=-` to the remote receiver. SSH
pull's `--files-from=- --from0` forwarding is wired symmetrically by
reading the local list and forwarding its bytes via
`server_config.connection.files_from_data`, matching daemon pull.
The same wiring is applied to the embedded-ssh transport.

The shared helper for serializing a local files-from source into the
wire format is moved to `client::remote::files_from_forwarding` and
re-exported from `daemon_transfer::orchestration::transfer` to keep
the existing daemon test surface intact.

Tests:

- Unit tests in `crates/core/src/client/remote/ssh_transfer.rs::tests`
  pin `files_from_path` propagation for each `FilesFromSource` variant.
- Unit tests in `crates/core/src/client/remote/invocation/tests.rs`
  pin the remote `--files-from` arg for each PUSH/PULL x local/remote
  combination.
- New integration test in
  `crates/transfer/tests/uts_files_from_ssh_push_relative.rs` drives
  the generator's `resolve_files_from_paths` + `build_file_list_with_base`
  pipeline against the upstream files-from.test source layout and
  asserts the wire-side file list never embeds the absolute source path.

Refs upstream `flist.c:2275-2298 send_file_list`, `options.c:2962-2974`,
`main.c:1191-1198,1322-1328,1372-1375`.

* fix(clippy): unused mut in test; gate test-only re-export

* fix(clippy): update import for Path after ptr_arg fix
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