Workspace can't be opened in devcontainer when workspace-file is a symbolic link outside of the workspace folder

Open
#6,605 2 comments 0 reactions 1 assignee View on GitHub

@chrmarti is already working on this.

Since Apr 27, 2022.

Assessment

This issue has not been assessed yet.

Description

bug containers

We are using symbolic links to assemble workspaces with templates.
One symbolic link is the workspace file itself which contains some default settings and a relative folder path.

{
"folders": [
{
"path": "./"
}
}

the symbolic link looks like vsc-sample-project.code-workspace -> ../shared/vsc/project_template.code-workspace

When open the workspace in dev-Container the target of the symbolic link will be used to start the WSL instance. The needed '.devcontainer' folder has another location and is not located relative to 'project_template.code-workspace'

  • VSCode Version: 1.66.1
  • Local OS Version: Windows 10 Pro 21H2
  • Remote OS Version: Gentoo/Ubuntu 20.04
  • Remote Extension/Connection Type: Docker/WSL
  • Logs:

[51 ms] Remote-Containers 0.231.5 in VS Code 1.66.1 (8dfae7a5cd50421d10cd99cb873990460525a898).
[51 ms] Start: Run: wsl -d Gentoo -e wslpath -u \wsl$\Gentoo\home\mguenther\git\samples\vsc-sample-project\shared\vsc\project_template.code-workspace
[290 ms] Start: Resolving Remote
[1832 ms] Start: Run: wsl -d Gentoo -e wslpath -u \wsl$\Gentoo\home\mguenther\git\samples\vsc-sample-project\shared\vsc
[2083 ms] Start: Run: wsl -d Gentoo -e /bin/sh -c cd '/home/mguenther/git/samples/vsc-sample-project/shared/vsc' && /bin/sh
[2091 ms] Start: Run in host: id -un
[2189 ms] mguenther
[2190 ms]
[2190 ms] Start: Run in host: cat /etc/passwd
[2193 ms] Start: Run in host: echo ~
[2194 ms] /home/mguenther
[2195 ms]
[2195 ms] Start: Run in host: test -x '/home/mguenther/.vscode-remote-containers/bin/8dfae7a5cd50421d10cd99cb873990460525a898/node'
[2197 ms]
[2197 ms]
[2197 ms] Start: Run in host: test -f '/home/mguenther/.vscode-remote-containers/dist/vscode-remote-containers-server-0.231.5.js'
[2199 ms]
[2199 ms]
[2200 ms] userEnvProbe: loginInteractiveShell (default)
[2201 ms] userEnvProbe shell: /bin/bash
[2456 ms] userEnvProbe PATHs:
Probe: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/home/mguenther/bin/jfrog:/home/mguenther/bin/vivado'
Container: None
[2458 ms] Setting up container for folder or workspace: /home/mguenther/git/samples/vsc-sample-project/shared/vsc/project_template.code-workspace
[2459 ms] Start: Check Docker is running
[2459 ms] Start: Run in Host: docker version --format {{.Server.APIVersion}}
[2506 ms] Server API version: 1.41
[2506 ms] Start: Run in Host: docker volume ls -q
[2556 ms] No dev container config found. Additional locations checked:
c:\Users\mguenther.vscode\extensions\ms-vscode-remote.remote-containers-0.231.5\dist\node_modules\vscode-dev-containers\repository-containers\gitlab.herrmannultraschall.com\8022\eet\firmware\shared.devcontainer\devcontainer.json
[2557 ms] Start: Run in Host: docker ps -q -a --filter label=vsch.local.folder=\wsl$\Gentoo\home\mguenther\git\samples\vsc-sample-project\shared\vsc --filter label=vsch.quality=stable
[2597 ms] Start: Run in Host: /home/mguenther/.vscode-remote-containers/bin/8dfae7a5cd50421d10cd99cb873990460525a898/node /home/mguenther/.vscode-remote-containers/dist/dev-containers-cli-0.231.5/dist/spec-node/devContainersSpecCLI.js up --container-data-folder .vscode-server/data/Machine --container-system-data-folder /var/vscode-server --workspace-folder /home/mguenther/git/samples/vsc-sample-project/shared/vsc --workspace-mount-consistency cached --id-label vsch.local.folder=\wsl$\Gentoo\home\mguenther\git\samples\vsc-sample-project\shared\vsc --id-label vsch.quality=stable --log-level debug --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true
[2736 ms] remote-containers 0.231.5.
[2736 ms] Start: Resolving Remote
[2740 ms] Error: Dev container config (/home/mguenther/git/samples/vsc-sample-project/shared/vsc/.devcontainer/devcontainer.json) not found.
[2740 ms] at IR (/home/mguenther/.vscode-remote-containers/dist/dev-containers-cli-0.231.5/dist/spec-node/devContainersSpecCLI.js:224:1687)
[2741 ms] at async Xw (/home/mguenther/.vscode-remote-containers/dist/dev-containers-cli-0.231.5/dist/spec-node/devContainersSpecCLI.js:224:3221)
[2741 ms] at async kR (/home/mguenther/.vscode-remote-containers/dist/dev-containers-cli-0.231.5/dist/spec-node/devContainersSpecCLI.js:224:13925)
[2741 ms] at async TR (/home/mguenther/.vscode-remote-containers/dist/dev-containers-cli-0.231.5/dist/spec-node/devContainersSpecCLI.js:224:13650)
[2746 ms] Exit code 1
[2747 ms] Command failed: /home/mguenther/.vscode-remote-containers/bin/8dfae7a5cd50421d10cd99cb873990460525a898/node /home/mguenther/.vscode-remote-containers/dist/dev-containers-cli-0.231.5/dist/spec-node/devContainersSpecCLI.js up --container-data-folder .vscode-server/data/Machine --container-system-data-folder /var/vscode-server --workspace-folder /home/mguenther/git/samples/vsc-sample-project/shared/vsc --workspace-mount-consistency cached --id-label vsch.local.folder=\wsl$\Gentoo\home\mguenther\git\samples\vsc-sample-project\shared\vsc --id-label vsch.quality=stable --log-level debug --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true
[2747 ms] Exit code 1

The correct path to load the WSL should be \wsl$\Gentoo\home\mguenther\git\samples\vsc-sample-project\workspace_a7\vsc-sample-project.code-workspace

Steps to Reproduce:

  1. create a folder which shall be the workspace folder
  2. create a .devcontainer folder + needed files to start a devcontainer
  3. create a symbolic link to a *.code-workspace file
  4. start VSC
  5. switch into WSL instance
  6. open workspace
  7. let VSC open the workspace in container

On a native Linux system this issue is not seen since the symbolic link is not resolved to the target location

Dominant language
Dockerfile
Stars
4.2k
Forks
470
Avg merge
1d 1h
Merged PRs (30d)
1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/vscode-remote-release

All issues in microsoft/vscode-remote-release

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.