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
When starting an SSH connection, the SSHMaster::startCommand checks the first line of the SSH process output to ensure it matches the string "started". However, the comparison fails due to an extra carriage return character (\r) in the output, causing the program to incorrectly throw an error even when the SSH connection starts successfully.
Run nix copy --to ssh://<user>@<host> nixpkgs#hello -vvv to copy hello package as an example
(Replace <user> and <host> with your remote user and host, respectively)
Error: error: failed to start SSH connection
Example
> nix copy --to ssh://[email protected] nixpkgs#hello -vvv
...
'\\wsl.localhost\NixOS\home\nixos'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.
SSH stdout first line: started
error: failed to start SSH connection to '[email protected]'
Expected behavior
The SSHMaster::startCommand should correctly identify the "started" message from the SSH process output, ignoring any extra carriage return characters, and proceed without throwing an error.
The comparison should succeed if the output is "started" with or without trailing whitespace or carriage return characters.
Metadata
❯ nix-env --version
nix-env (Nix) 2.24.8
Additional context
This is because the ssh.exe on Windows returns with the carriage return characters (\r) at the end.
So the real output is:
Reply ASCII: 115 116 97 114 116 101 100 13
s t a r t e d \r
Expected ASCII: 115 116 97 114 116 101 100
s t a r t e d
Which is why the check (reply != "started") returns true, and the error occurs.
My goal is to use ssh.exe on Windows to forward the authentication process with 1Password SSH WSL.
I tried symlinking the ssh to /mnt/c/Windows/System32/OpenSSH/ssh.exe using a derivation and set the ssh.package NixOS options to it.
Other programs, such as git, do work as intended though. And after I tried trimming the reply variable (e.g. reply = trim(reply);) before checking it (if (reply != "started") {). IT WORKS!
Describe the bug
When starting an SSH connection, the
SSHMaster::startCommand
checks the first line of the SSH process output to ensure it matches the string"started"
. However, the comparison fails due to an extra carriage return character (\r) in the output, causing the program to incorrectly throw an error even when the SSH connection starts successfully.Steps To Reproduce
ssh
tossh.exe
(/mnt/c/Windows/System32/OpenSSH/ssh.exe
)ln -s /mnt/c/Windows/System32/OpenSSH/ssh.exe ~/ssh
PATH
nix copy --to ssh://<user>@<host> nixpkgs#hello -vvv
to copyhello
package as an example(Replace
<user>
and<host>
with your remote user and host, respectively)error: failed to start SSH connection
Example
Expected behavior
The
SSHMaster::startCommand
should correctly identify the"started"
message from the SSH process output, ignoring any extra carriage return characters, and proceed without throwing an error.The comparison should succeed if the output is "started" with or without trailing whitespace or carriage return characters.
Metadata
Additional context
This is because the
ssh.exe
on Windows returns with the carriage return characters (\r
) at the end.So the real output is:
Which is why the check (
reply != "started"
) returns true, and the error occurs.My goal is to use
ssh.exe
on Windows to forward the authentication process with 1Password SSH WSL.I tried symlinking the
ssh
to/mnt/c/Windows/System32/OpenSSH/ssh.exe
using a derivation and set thessh.package
NixOS options to it.My
ssh-wrapper
package:Other programs, such as git, do work as intended though. And after I tried trimming the
reply
variable (e.g.reply = trim(reply);
) before checking it (if (reply != "started") {
). IT WORKS!Checklist
Add 👍 to issues you find important.
The text was updated successfully, but these errors were encountered: