Files
zed/crates/remote
Yossi Eliaz 6569db7470 remote: Accept shell-quoted ssh executable in SSH command lines (#66360)
## Why

Remote Projects accepts either a bare destination or a full `ssh ...`
command. Commands that tools print with every token shell-quoted (for
example `'ssh' '-p' '64042' 'user@127.0.0.1'`) work in a shell but Zed
rejects them with `unsupported argument`. The goal is that any valid SSH
command pasted into **Connect New Server** parses the same way whether
or not its tokens are quoted.

Closes #61101

## Summary

`SshConnectionOptions::parse_command_line` stripped a literal, unquoted
`ssh ` prefix from the raw string before tokenizing. With a quoted
`'ssh'`, the prefix didn't match, so after tokenizing `ssh` became the
hostname and the real destination was rejected as an extra argument.

This change tokenizes first and then drops a leading `ssh` token when
more tokens follow. A lone `ssh` is still treated as a hostname, as
before.

## Testing

- Added `test_parse_command_line_with_ssh_executable` covering unquoted,
single-quoted (including an identity path with spaces), and
double-quoted `ssh` executables, plus `ssh` used as a host. It fails on
`main` with `unsupported argument: "user@127.0.0.1"` and passes with
this change.
- `cargo test -p remote`: 56 passed
- `cargo fmt -p remote -- --check`
- `./script/clippy -p remote`

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist). (No UI
changes.)
- [x] Tests cover the new or changed behavior.

AI disclosure: this change was AI-assisted. I reviewed the diff and the
test.

Release Notes:

- Fixed Remote Projects rejecting SSH commands whose `ssh` executable is
shell-quoted.
2026-11-02 12:01:06 +00:00
..