coder / sshcode

Run VS Code on any server over SSH.
MIT License
5.74k stars 215 forks source link

[MSYS BUG][Reason Discovered] ~ is resolved to msys home instead of remote home #180

Open Merith-TK opened 4 years ago

Merith-TK commented 4 years ago

NOTICE: This first post is for when using sshcode user@server ~/X paths,

DISCLAIMER: This example was shown to affect both sshcode 10 builds and custom builds that use code-server 3.X

When you feed sshcode ~/ instead of "~/", it will attempt to use the local ~/ path. for example if your user is merith and the remote user is developer when you feed sshcode ~/Workspace it will attempt to open /home/merith/Workspace instead of /home/developer/Workspace

output from a shell giving this error

2020-05-11 12:26:24 ←[94mINFO←[0m       OS is windows, disabling connection reuse feature
2020-05-11 12:26:24 ←[94mINFO←[0m       ensuring code-server is updated...
++ uname -m
+ '[' x86_64 '!=' x86_64 ']'
+ pkill -f /home/developer/.sshcode-server
+ true
+ mkdir -p /home/developer/.sshcode-server
+ cd /home/developer/.sshcode-server
+ '[' '!' -d code-server-3.2.0-linux-x86_64 ']'
2020-05-11 12:26:27 ←[94mINFO←[0m       starting code-server...
2020-05-11 12:26:27 ←[94mINFO←[0m       Tunneling remote port 33885 to 127.0.0.1:24586
info  code-server 3.2.0 fd36a99a4c78669970ebc4eb05768293b657716f
info  HTTP server listening on http://127.0.0.1:33885
info    - No authentication
info    - Not serving HTTPS
info  Automatic updates are enabled
warn  ENOENT: no such file or directory, stat '/home/Merith/Workspace'
warn  ENOENT: no such file or directory, stat '/home/Merith/Workspace'

What fixes this.

These work

sshcode user@server "~/Workspace"
sshcode user@server \~/Workspace
sshcode user@server Workspace
sshcode user@server /opt/Workspace
sshcode user@server /home/user/Workspace

This dont work

sshcode user@server ~/Workspace

Merith-TK commented 4 years ago

Notice: this is for if gitbashWindowsDir() is not properly handling paths,

Still under investigation

$ go run ./ developer@192.168.115 --skipsync "~/Workspace"
2020-05-11 12:40:58 ←[94mINFO←[0m       OPENING:L659 ~C:/msys64/Workspace
2020-05-11 12:40:58 ←[94mINFO←[0m       OPENING:L677 ~C:/msys64/Workspace
2020-05-11 12:40:58 ←[94mINFO←[0m       OS is windows, disabling connection reuse feature
2020-05-11 12:40:58 ←[94mINFO←[0m       ensuring code-server is updated...
++ uname -m
+ '[' x86_64 '!=' x86_64 ']'
+ pkill -f /home/developer/.sshcode-server
+ true
+ mkdir -p /home/developer/.sshcode-server     
+ cd /home/developer/.sshcode-server
+ '[' '!' -d code-server-3.2.0-linux-x86_64 ']'
2020-05-11 12:41:03 ←[94mINFO←[0m       starting code-server...
2020-05-11 12:41:03 ←[94mINFO←[0m       Tunneling remote port 40727 to 127.0.0.1:35503
info  code-server 3.2.0 fd36a99a4c78669970ebc4eb05768293b657716f
info  HTTP server listening on http://127.0.0.1:40727
info    - No authentication
info    - Not serving HTTPS
info  Automatic updates are enabled
warn  ENOENT: no such file or directory, stat '/home/developer/~C:/msys64/Workspace'
warn  ENOENT: no such file or directory, stat '/home/developer/~C:/msys64/Workspace'