add: -l USER flag for rsync compatibility#43
Merged
Conversation
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.
Owner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
iroh-sshworks as aRSYNC_RSH(orrsync -e) drop-in foruser@hostinvocations, 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 USERtoSshOptsand passes it through to the underlyingssh. With it,RSYNC_RSH=iroh-ssh rsync /local user@<endpoint_id>:/remoteworks regardless of which form rsync chooses.The ssh-
Commandconstruction was extracted out ofstart_sshinto a synchronousbuild_ssh_commandhelper so it can be unit-tested without spawning a process.Test plan
cargo test— new tests insrc/ssh.rs:login_user_flag_is_passed_to_ssh— bare flag is forwarded to sshrsync_invocation_parses_and_builds— fulliroh-ssh -l alice <id> rsync --server -e.LsfxCIvu . /tmp/destinvocation parses asCliand builds an sshCommandwith-l alicebefore the hostiroh-ssh --helpshows the new-l <USER>flagRSYNC_RSH=iroh-ssh rsync …against a real iroh-ssh server