microsoft / vscode-remote-release

Visual Studio Code Remote Development: Open any folder in WSL, in a Docker container, or on a remote machine using SSH and take advantage of VS Code's full feature set.
https://aka.ms/vscode-remote
Other
3.63k stars 282 forks source link

[Remote-SSH Bug]: cygwin scp commandline error #9991

Closed cmeriaux closed 2 months ago

cmeriaux commented 3 months ago

Is there an existing issue for this bug?

Required Troubleshooting Steps

Connect Locally

It doesn’t connect successfully (same error message)

->

No response

Expected Behavior

Uploading a tarball should work

Steps To Reproduce

  1. Use Windows host, with cygwin openssh
  2. connect to a linux remote plateform

Remote-SSH Log

Remote-SSH Log

``` 09:29:08.333] Downloading VS Code server locally... [09:29:08.470] Downloaded VS Code server to c:\Users\CHRIST~1.MER\AppData\Local\Temp\0c521cb6-855e-45fb-9568-c45cf0a2b153 [09:29:08.472] Renamed VS Code server to c:\Users\CHRIST~1.MER\AppData\Local\Temp\vscode_server_1718954948470\vscode-cli-611f9bfce64f25108829dd295f54a6894e87339d.tar.gz [09:29:08.476] Checking ssh with "C:\tools\cygwin\bin\ssh.exe -V" [09:29:08.666] > OpenSSH_9.7p1, OpenSSL 3.0.13 30 Jan 2024 [09:29:08.672] Expecting scp to be next to ssh at C:\tools\cygwin\bin\scp.exe [09:29:08.673] Testing scp with "C:\tools\cygwin\bin\scp.exe" [09:29:08.815] scp exited with code: 1 [09:29:08.815] Got stderr from scp: usage: scp [-346ABCOpqRrsTv] [-c cipher] [-D sftp_server_path] [-F ssh_config] [-i identity_file] [-J destination] [-l limit] [-o ssh_option] [-P port] [-S program] [-X sftp_option] source ... target [09:29:08.816] Using SSH config file "C:\tools\cygwin\home\christophe.meriaux\.ssh\config" [09:29:08.816] Copying file to remote with "C:\tools\cygwin\bin\scp.exe" -F "C:\tools\cygwin\home\christophe.meriaux\.ssh\config" "c:\Users\CHRIST~1.MER\AppData\Local\Temp\vscode_server_1718954948470\vscode-cli-611f9bfce64f25108829dd295f54a6894e87339d.tar.gz" "vscode-cli-611f9bfce64f25108829dd295f54a6894e87339d.tar.gz.done" emulation:"/home/cmeriaux/.vscode-server" [09:29:08.816] Using cwd: file:///c%3A/Users/CHRIST~1.MER/AppData/Local/Temp/vscode_server_1718954948470 [09:29:08.816] Terminal shell path: C:\Windows\System32\cmd.exe [09:29:14.984] > ssh: Could not resolve hostname c: Name or service not known > ]0;C:\Windows\System32\cmd.exe [09:29:15.000] > /usr/bin/scp: Connection closed [09:29:16.465] "Copy server to host" terminal command done [09:33:08.073] > > ``` ```

Anything else?

scp cygwin version does not understand the command line. It seems that SCP doesn't understand the path "c:\Users\CHRIST~1.MER\AppData\Local\Temp\vscode_server_1718954948470\vscode-cli-611f9bfce64f25108829dd295f54a6894e87339d.tar.gz". It seems that scp only support path with /cygdrive/c......

A solution could be: move to the current directory of the file, then use local path vscode-cli-611f9bfce64f25108829dd295f54a6894e87339d.tar.gz

What do you think about that Thanks

Hydrant777 commented 2 months ago

Hello,

Experiencing the exact same issue after 1.89.1 update:

[10:19:02.307] Using cwd: file:///c%3A/Users/A349051/AppData/Local/Temp/vscode_server_1719908341504
[10:19:02.307] Terminal shell path: C:\WINDOWS\System32\cmd.exe
[10:19:06.568] > ssh: Could not resolve hostname c: Temporary failure in name resolution
> /usr/bin/scp: Connection closed
> ]0;C:\WINDOWS\System32\cmd.exe
[10:19:07.905] "Copy server to host" terminal command done
[10:23:00.936] > 

I would assume it's because of the SSH update: https://code.visualstudio.com/updates/v1_89#_remote-development I believe the colon ":" is replaced with "%3A" and fails subsequently in scp command.

Thank you for support.

roblourens commented 2 months ago

https://github.com/microsoft/vscode-remote-ssh/pull/422/files @connor4312 ?

connor4312 commented 2 months ago

Not sure that PR in particular, but somewhere between then and now we started passing in absolute paths with cygwin SCP falls over on. This is pretty ugly but easy enough to fix 🤷

connor4312 commented 2 months ago

ah, it was that PR. We used the "proper" platform path handling based on the remote path, but that meant we were doing path.unix.basename(localPath) which no-op'ed and caused an absolte path to be passed to scp

connor4312 commented 2 months ago

Fixed in tonight's remote - ssh prerelease version, sorry for the trouble

cmeriaux commented 2 months ago

@connor4312 Your Fix works fine, it has also fixed other side effect. Greatly appreciate your work Thanks