PowerShell / PowerShell/Win32-OpenSSH
Invoking `ssh` in a command substitution in a `ProxyCommand` hangs
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 8.3k
- Forks
- 819
- PR merge metrics
- No merged PRs in 30d
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest version
- Search the existing issues.
Steps to reproduce
I'm using a ProxyCommand that itself invokes SSH via command substitution in PowerShell, which can be simplified to the following configuration:
Host host
User <user-on-host>
Host test
User <user-on-host>
ProxyCommand powershell.exe -noprofile -command "ssh -x -W $(ssh -x -n host echo host):%p host"
where host is a Linux host I have access to, i.e. I can do ssh host. I invoke the following command:
ssh test
This command hangs.
The same configuration works in WSL (OpenSSH_8.9p1 Ubuntu-3, OpenSSL 3.0.2 15 Mar 2022), and connects me to host. EDIT 2024-12-01 An equivalent configuration also works in WSL, which does not involve PowerShell:
Host host
User <user-on-host>
Host test2
User <user-on-host>
ProxyCommand ssh -W $(ssh -x -n host echo host):%p host
Expected behavior
I get a shell on host.
Actual behavior
The command hangs. When I type ctrl-c, I get:
chan_shutdown_write: channel 0: close() failed for fd -1 [i3 o1]: Interrupted function call
Error details
PowerShell does not return an error.
Environment data
Name Value
---- -----
PSVersion 5.1.22621.4249
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.22621.4249
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Version
OpenSSH_for_Windows_9.8p1 Win32-OpenSSH-GitHub, LibreSSL 3.9.2
Visuals
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Begin by reproducing issue 2305 with the shown ProxyCommand in Windows PowerShell, then compare it with the equivalent WSL command-substitution case. Trace the SSH invocation and ProxyCommand behavior involved in the hang; done means ssh test reaches a shell on host without requiring Ctrl-C.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- powershell
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100