Skip to content

Stop the Devcontainer Snippets Joining HOME and USERPROFILE Into an Invalid Mount Path on Windows #3852

Closed

Description

@ptr727

Split from #1763 for the windows handoff lane, since this is the one part of that issue only a Windows host can verify.

Defect

Each bind mount source in catalog/snippets/devcontainer/python/devcontainer.json and catalog/snippets/devcontainer/dotnet/devcontainer.json joins ${localEnv:HOME}${localEnv:USERPROFILE}. That works while exactly one of the two is set. On a Windows host where both are set, for example VS Code launched from Git Bash, the join gives an invalid path such as C:\Users\x/c/Users/x/.ssh/..., and the container fails to start.

Why This Needs a Windows Host

The failure needs a Windows host environment holding both variables, VS Code, and a container runtime. A Linux host never sets USERPROFILE, and the hosted windows-latest job runs the unit suite and starts no devcontainer. So nothing but a Windows host can reproduce the failure or verify the fix.

Done When

  • A devcontainer built from each snippet starts on a Windows host with both variables set.
  • It still starts on a Windows host launched normally, with only USERPROFILE set.
  • It still starts on Linux, with only HOME set. This is the regression a Windows-only fix could cause.

Bounds

The rest of #1763 stays there: the mktemp -t template in post-create.sh, and the JSONC comment documenting the required host paths, which the maintainer chose in #3754. That comment sits beside the same mounts lines, so whichever change lands second rebases over the first.

Activity

  1. ptr727 commented on Nov 4, 2026

    @ptr727
    OwnerAuthor

    Maintainer answer (2026-11-03): document the limit and close this issue, rather than moving the snippets to Compose.

    devcontainer.json has no way to choose one variable: substitution is one non-greedy regex pass whose default is literal text, so any form still naming HOME keeps the join on Windows. A Compose file using ${USERPROFILE:-${HOME}} was the only form that could meet this issue's first Done When item, and it was declined for its cost against one launch path with a workaround.

    So the first Done When item is dropped. The second holds only with conditions the docs now state, since the measured start used a synthetic home and a replaced image tag. A real Windows host can also lack the gh mount source, because Windows gh defaults to %AppData%\GitHub CLI. The third is moot, since no mount line changes. The shipped image tags fail on every host, which is filed as #3858.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions