You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ssh -t exec path concatenates the command unquoted — GNU-style -c shells lose all but the first word #2478
This produces "C:\shell.exe" -c echo a b. Any shell whose -c takes a single operand (GNU semantics — bash, and other bash-compatible shells)
then runs echo with a b demoted to $0/$1: the command silently
truncates to its first word.
Set a GNU-style shell as DefaultShell (e.g. Git Bash bash.exe or
Niubash niu.exe) with DefaultShellCommandOption = -c, then:
ssh -tt host 'whoami' → works (single word)
ssh -tt host 'sleep 30' → "sleep: missing operand" (30 lost)
ssh -tt host 'printf ok123' → "printf: usage: ..." (ok123 lost)
ssh -tt host 'echo x > f.txt' → bare echo; redirect never reaches the shell
ssh -tt host 'cmd /c echo x' → an interactive cmd prompt (args dropped)
The same commands work fine without -t, confirming the quoting
discrepancy between the two branches. cmd.exe and powershell.exe are not
affected because their /c/-c consume the rest of the command line —
which is presumably why this has gone unnoticed.
Expected
ssh -tt host 'sleep 30' runs sleep 30, same as without a pty.
Suggested fix
Quote the command operand in the pty branch (with proper
CommandLineToArgvW escaping for embedded quotes/backslashes), e.g.
append "%s" — noting that merely wrapping in quotes is not sufficient
for commands that already contain quotes; the escaping rules used by build_exec_command/the non-pty path should be mirrored.
Activity