Skip to content

add: -l USER flag for rsync compatibility#43

Merged
rustonbsd merged 2 commits into
rustonbsd:mainfrom
futpib:feat-login-user-flag
May 11, 2026
Merged

add: -l USER flag for rsync compatibility#43
rustonbsd merged 2 commits into
rustonbsd:mainfrom
futpib:feat-login-user-flag

Conversation

@futpib

@futpib futpib commented May 6, 2026

Copy link
Copy Markdown
Contributor

Summary

iroh-ssh works as a RSYNC_RSH (or rsync -e) drop-in for user@host invocations, but rsync sometimes invokes its remote shell as <rsh> -l user host cmd… — and the CLI didn't accept -l, so that path failed at parse time.

This adds -l USER to SshOpts and passes it through to the underlying ssh. With it, RSYNC_RSH=iroh-ssh rsync /local user@<endpoint_id>:/remote works regardless of which form rsync chooses.

The ssh-Command construction was extracted out of start_ssh into a synchronous build_ssh_command helper so it can be unit-tested without spawning a process.

Test plan

  • cargo test — new tests in src/ssh.rs:
    • login_user_flag_is_passed_to_ssh — bare flag is forwarded to ssh
    • rsync_invocation_parses_and_builds — full iroh-ssh -l alice <id> rsync --server -e.LsfxCIvu . /tmp/dest invocation parses as Cli and builds an ssh Command with -l alice before the host
  • iroh-ssh --help shows the new -l <USER> flag
  • Manual: RSYNC_RSH=iroh-ssh rsync … against a real iroh-ssh server

futpib and others added 2 commits May 6, 2026 10:26
rsync's default invocation pattern with `-e iroh-ssh` can be
`<rsh> -l user host cmd...` rather than `<rsh> user@host cmd...`.
Without -l, that path failed CLI parsing. Pass -l through to the
underlying ssh and cover both the bare-flag case and the full
rsync-style parse with unit tests.

Refactor ssh command construction out of start_ssh into a
synchronous build_ssh_command helper so it's testable without
spawning.
@rustonbsd

Copy link
Copy Markdown
Owner

@futpib thanks for the addition. I should do a pass and add all ssh commands in the future ^^, will add that to the todo's.

I tested the rsync locally and I like the testable cmd builder. I will impl #42 next and then release it as v0.2.11 as soon as possible.

@rustonbsd rustonbsd merged commit 3427ae9 into rustonbsd:main May 11, 2026
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants