Repository navigation
Closed
Labels
author-verification-requestedIssues potentially verifiable by issue authorbugIssue identified by VS Code Team member as probable bugtasksvariable-resolvingverifiedVerification succeeded
Milestone
Description
-
VSCode Version: 1.56.0, 1.56.1, 1.56.2
-
Local OS Version: confirmed on Windows and macOS
-
Remote OS Version: confirmed for Ubuntu 18.04 and 20.10
-
Remote Extension/Connection Type: SSH
-
Logs:
Remote - SSH (probably not very interesting)
[11:44:56.191] Log Level: 2 [11:44:56.193] [email protected] [11:44:56.193] darwin x64 [11:44:56.195] SSH Resolver called for "ssh-remote+ubuntu-2010", attempt 1 [11:44:56.196] "remote.SSH.useLocalServer": true [11:44:56.197] "remote.SSH.path": undefined [11:44:56.197] "remote.SSH.configFile": undefined [11:44:56.197] "remote.SSH.useFlock": true [11:44:56.198] "remote.SSH.lockfilesInTmp": false [11:44:56.198] "remote.SSH.localServerDownload": auto [11:44:56.198] "remote.SSH.remoteServerListenOnSocket": false [11:44:56.198] "remote.SSH.showLoginTerminal": false [11:44:56.199] "remote.SSH.defaultExtensions": [] [11:44:56.199] "remote.SSH.loglevel": 2 [11:44:56.199] SSH Resolver called for host: ubuntu-2010 [11:44:56.199] Setting up SSH remote "ubuntu-2010" [11:44:56.204] Acquiring local install lock: /var/folders/vx/hn90mz9j7x1bw6j_msm723h80000gn/T/vscode-remote-ssh-ubuntu-2010-install.lock [11:44:56.208] Looking for existing server data file at /Users/simon/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-ubuntu-2010-cfa2e218100323074ac1948c885448fdf4de2a7f-0.65.4/data.json [11:44:56.210] Found local server running: {"remoteListeningOn":{"port":37313},"osReleaseId":"ubuntu","arch":"aarch64","webUiAccessToken":"","sshAuthSock":"","display":"","tmpDir":"/run/user/1001","platform":"linux","connectionToken":"111a1a11-1111-111a-11a1-aaa1a111a111","pid":13415,"ipcHandlePath":"/var/folders/vx/hn90mz9j7x1bw6j_msm723h80000gn/T/vscode-ssh-askpass-eb0a9280e25337a77881329b4dbcab26f2148d64.sock","socksPort":57479,"startupTime":1620293406903} [11:44:56.220] Found running server - short-circuiting install [11:44:56.222] Starting forwarding server. localPort 59100 -> socksPort 57479 -> remotePort 37313 [11:44:56.223] Forwarding server listening on 59100 [11:44:56.223] Waiting for ssh tunnel to be ready [11:44:56.225] [Forwarding server 59100] Got connection 0 [11:44:56.226] Tunneled 37313 to local port 59100 [11:44:56.226] Resolved "ssh-remote+ubuntu-2010" to "127.0.0.1:59100" [11:44:56.232] ------[11:44:56.262] [Forwarding server 59100] Got connection 1
[11:44:56.290] [Forwarding server 59100] Got connection 2
[11:44:57.698] [Forwarding server 59100] Got connection 3
Steps to Reproduce:
- Open the following workspace configuration:
{ "folders": [ { "path": ".." } ], "settings": { "someSetting": "${workspaceFolder}/qux" }, "tasks": { "version": "2.0.0", "tasks": [ { "label": "echo", "type": "shell", "command": "echo", "args": [ "This should be an absolute path: ", "${config:someSetting}" ], "problemMatcher": [] } ] } } - Run the task echo.
- Expected behavior (as well as the behavior of VS Code 1.55.x): The task output contains the absolute path to the workspace folder, e.g.
This should be an absolute path: /home/foo/workspace/qux - Encountered behavior with VS Code 1.56: The place where the path to the workspace folder should be is empty, e.g.
This should be an absolute path: /qux
Does this issue occur when you try this locally?: No
Metadata
Metadata
Labels
author-verification-requestedIssues potentially verifiable by issue authorbugIssue identified by VS Code Team member as probable bugtasksvariable-resolvingverifiedVerification succeeded
Activity
sleiner commentedon May 12, 2021
One of the patches in 1.56.1 seems related to this problem. In any case, I am seeing the bug in 1.56.1 also.
sleiner commentedon May 14, 2021
I just drilled down a bit harder and found that nested variable substitution is not generally broken. Rather it seems that the nested substitution of ${workspaceFolder} is broken (again, only in remote development). To illustrate, here is an extend version of the workspace configuration above, showing that:
${config:variable}works${workspaceFolder}works${workspaceFolder}is broken{ "folders": [ { "path": "." } ], "settings": { "someSetting": "${workspaceFolder}/qux", "someOtherSetting": "${config:dependentSetting}/foo", "dependentSetting": "/substitution/works/here" }, "tasks": { "version": "2.0.0", "tasks": [ { "label": "Nested substitution with another config variable (does not trigger bug)", "type": "shell", "command": "echo", "args": [ "This should begin with \"/substitution/works/here\": ", "${config:someOtherSetting}" ], "problemMatcher": [] }, { "label": "Simple substitution with workspaceFolder (does not trigger bug)", "type": "shell", "command": "echo", "args": [ "This should be the absolute path to the current workspace: ", "${workspaceFolder}" ], "problemMatcher": [] }, { "label": "Nested substitution with workspaceFolder (DOES TRIGGER BUG)", "type": "shell", "command": "echo", "args": [ "This should contain the absolute path to the current workspace: ", "${config:someSetting}" ], "problemMatcher": [] } ] } }sleiner commentedon May 18, 2021
I spent some more time with this issue and think I might have found the root cause of the bug. I found the following:
The bug is also present with the Container remote. I have not tried WSL.
When opening the developer tools while triggering the bug, this error message is shown:
Of course, I have a folder open. So I put a breakpoint in the closure that throws the error (
getFolderUri) and found the following:For running the task one time, the function is called three times:
Two times out of the

resolveAnycontext. Here, the correct folder URI is returned successfully:One time out of the


_resolveProfilecontext. Here, the error message is generated.I traced the fact that
folderUriis undefined back to_resolveProfile, wherelastActiveWorkspace(which is passed as a parameter to_resolveVariables) is undefined:When executing the same task locally (which works fine, as written in the original bug report),

lastActiveWorkspaceactually contains the right path:So, we established that
lastActiveWorkspaceis undefined when it should not be, so I tried to trace the origin of this.As far as I see,
activeWorkspaceRootUrineeds to be defined in order forlastActiveWorkspaceto be defined.Locally,
activeWorkspaceRootUriis actually defined. When working remotely, it is not. So I looked intogetLastActiveWorkspaceRoot.So, the reason that

undefinedis returned here is that_resolveProfilesetsschemeFilterto"file"but the actual scheme is"vscode-remote"(at least when working remotely, locally it actually is"file"):So I guess, this bug can be resolved by either removing the
schemeFilteror changing it tovscode-remotewhen working remotely. But I have no idea what makes sense here, this was my first look at the internals of VS Code itself 🤷🏼♂️Furthermore, I cannot change and test this easily as the remote extensions do not work with the OSS build 😕
FWIW: All of the above was tested using 1.56.2, but I confirmed additionally that the bug still exists with the current insider build (Commit: 45aafeb326d0d3d56cbc9e2932f87e368dbf652d, Date: 2021-05-18T05:12:52.309Z).
So, Christof Marti (@chrmarti): Is there anything I can do to get this fixed? 😊
chrmarti commentedon May 20, 2021
Simon Leiner (@sleiner) Thanks for the analysis! Have you checked if this is still a problem with VS Code Insiders? (https://code.visualstudio.com/insiders/)
sleiner commentedon May 20, 2021
Yes, I have 👍 Still a problem on the latest insiders build as of now:
Commit: 29c61570a5b9a669f777bb28b5acd5c37d99edbe
Date: 2021-05-20T05:11:47.260Z (1 hr ago)
alexr00 commentedon May 31, 2021
Interesting. I thought only the tasks system was resolving variables on this execution path, but it seems that terminal is also resolving variables.
What's happening:
So, at most you'd get 1 level of nesting.
Here, the problem is that step 2 is not happening correctly. Daniel Imms (@Tyriar), this is caused by what appears to be an unsafe usage of
Schemas.file. I think here you should instead use the remote schema when remote:https://github.com/microsoft/vscode/blob/7ce379e3f2bd184ace37d365d012ce00e6b74ca3/src/vs/workbench/contrib/terminal/browser/terminalProfileResolverService.ts#L320-L321
Daniel Imms (@Tyriar) I think that change is needed regardless of other changes that I will make to help this issue.
alexr00 commentedon May 31, 2021
Simon Leiner (@sleiner) I've added limited support for variables that resolve to other variables, which should solve your issue.
Daniel Imms (@Tyriar) I think you might still want to change the
Schemas.filementioned above.sleiner commentedon Jun 1, 2021
Thanks so much, Alex Ross (@alexr00)! That solves my concrete problem indeed 🚀
You say that there is "limited support" now. Could you elaborate on what the limits are?Nevertheless, during first tests today I did not hit the limits 😃 But I will put it through more thorough tests during the next days.
Also, during my tests today I ran into a problem that is possibly connected :/ #5128
alexr00 commentedon Jun 2, 2021
By limited support I mean that
commandandinputvariables won't get this treatment. Predefined, env, and config variables should all work this way now.sleiner commentedon Jun 4, 2021
Thanks for the explanation 👍🏻
Squashed 'lib/vscode/' changes from cfa2e218100..2064d4c301c
feat(vscode): update to version 1.57.0 (#3544)
Add limited support for variables that resolve to other variables