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.6k stars 273 forks source link

`remote.SSH.serverInstallPath` does not respect environment variables now #9474

Closed Lablace closed 2 weeks ago

Lablace commented 6 months ago

Steps to Reproduce:

  1. Change the value in one of the key-value pairs in remote.SSH.serverInstallPath setting to one that contains well-known representives for home directory (like ${HOME} and ~ (tilde)).
  2. Connect to the modified remote server, it now creates the directory with the above name and tries to install the vscode-server there rather than expanding it to home directory where a vscode-server has been already installed.
  3. Change the modified value back to an absolute path, like /home/alice, and retry connecting to the server, the installed vscode-server in home directory can be found now.

Prior to VSCode 1.86.0, I've been using ${HOME} in my remote.SSH.serverInstallPath without any problem, so I am sure it had the ability to expand these before.

Does this issue occur when you try this locally?: Yes/No No, Remote-SSH is needed. Does this issue occur when you try this locally and all extensions are disabled?: Yes/No No, Remote-SSH is needed.

arghness commented 6 months ago

Confirmed here as well. I have a home directory shared between multiple docker containers and I was using ~ and ${HOSTNAME} to configure each server install path and they stopped expanding.

As an aside, it would be nice if it handled wildcards for the remote host, like remote.SSH.remotePlatform so that I wouldn't have to configure each one individually.

roblourens commented 5 months ago

Does setting "remote.SSH.useExecServer": false make a difference?

Lablace commented 5 months ago

Does setting "remote.SSH.useExecServer": false make a difference?

No, I've tried "remote.SSH.useExecServer" with both true and false, and it didn't make a difference. I've been using configs below (uppercase values are omitted):

{
    "remote.downloadExtensionsLocally": true,
    "remote.SSH.configFile": "CONFIG_FILE",
    "remote.SSH.localServerDownload": "always",
    "remote.SSH.remotePlatform": {
        "REMOTE": "linux"
    },
    "remote.SSH.serverInstallPath": {
        "REMOTE": "$HOME/SOME_DIRECOTORY"
    },
    "remote.SSH.suppressWindowsSshWarning": true,
    "remote.SSH.useExecServer": false,
    "remote.SSH.useLocalServer": true,
}
djobin commented 4 months ago

Same here. We are 20ish users here with the same issue.

Before, we were using:

"remote.SSH.serverInstallPath": {
    "server1": "~/.vscode-server/server1",
    "server2": "~/.vscode-server/server2"
}

Since 1.86.0, this config wrecks our home folder (and vscode-server installations) by creating a folder named '~' /home/username/~/.vscode-server/serverX

Notice the litteral tilde '~' folder in the path.

We tried replacing with $HOME, {$HOME}, {$env:HOME} .. nothing works anymore. We now have to rely on hardcoding the full path.

here is an excerpt from the remote-ssh log :

[11:35:43.279] > code 1.87.2 (commit 863d2581ecda6849923a2118d93a088b0745d9d6)
[11:35:43.307] > Starting VS Code CLI... "$HOME/.vscode-server/server1/.vscode-server/code-863d2581ecda6849923a2118d93a088b0745d9d6" command-shell --cli-data-dir "$HOME/.vscode-server/server1/.vscode-server/cli" --on-port --parent-process-id 3259736 &> "$HOME/.vscode-server/server1/.vscode-server/.cli.863d2581ecda6849923a2118d93a088b0745d9d6.log" < /dev/null  
[11:35:43.310] > Removing old logfile at $HOME/.vscode-server/server1/.vscode-server/.cli.863d2581ecda6849923a2118d93a088b0745d9d6.log
[11:35:43.316] stderr> cat: '$HOME/.vscode-server/server1/.vscode-server/.cli.863d2581ecda6849923a2118d93a088b0745d9d6.log': No such file or directory

[11:35:43.390] > Exec server process not found
[11:35:43.398] > main: line 321: $HOME/.vscode-server/server1/.vscode-server/code-863d2581ecda6849923a2118d93a088b0745d9d6: No such file or directory
arghness commented 4 months ago

Same here. We are 20ish users here with the same issue.

Before, we were using:

"remote.SSH.serverInstallPath": {
    "server1": "~/.vscode-server/server1",
    "server2": "~/.vscode-server/server2"
}

Since 1.86.0, this config wrecks our home folder (and vscode-server installations) by creating a folder named '~' /home/username/~/.vscode-server/serverX

Notice the litteral tilde '~' folder in the path.

We tried replacing with $HOME, {$HOME}, {$env:HOME} .. nothing works anymore. We now have to rely on hardcoding the full path.

here is an excerpt from the remote-ssh log :

[11:35:43.279] > code 1.87.2 (commit 863d2581ecda6849923a2118d93a088b0745d9d6)
[11:35:43.307] > Starting VS Code CLI... "$HOME/.vscode-server/server1/.vscode-server/code-863d2581ecda6849923a2118d93a088b0745d9d6" command-shell --cli-data-dir "$HOME/.vscode-server/server1/.vscode-server/cli" --on-port --parent-process-id 3259736 &> "$HOME/.vscode-server/server1/.vscode-server/.cli.863d2581ecda6849923a2118d93a088b0745d9d6.log" < /dev/null  
[11:35:43.310] > Removing old logfile at $HOME/.vscode-server/server1/.vscode-server/.cli.863d2581ecda6849923a2118d93a088b0745d9d6.log
[11:35:43.316] stderr> cat: '$HOME/.vscode-server/server1/.vscode-server/.cli.863d2581ecda6849923a2118d93a088b0745d9d6.log': No such file or directory

[11:35:43.390] > Exec server process not found
[11:35:43.398] > main: line 321: $HOME/.vscode-server/server1/.vscode-server/code-863d2581ecda6849923a2118d93a088b0745d9d6: No such file or directory

In your case, would it just work to have ".vscode-server/serverX", as it seems to be prepending your home dir anyway?

djobin commented 4 months ago

🤦‍♂️

In your case, would it just work to have ".vscode-server/serverX", as it seems to be prepending your home dir anyway?

You are totally right.....my savior! Thank you!

gmertes commented 3 months ago

Same problem here. The env var is not expanded, and the path is treated like a literal.

    "remote.SSH.serverInstallPath": {
        "REMOTE": "$HOME"
    }

Results in the folder ~/'$HOME' being created.

vs-code-engineering[bot] commented 2 weeks ago

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!