Skip to content

Python devcontainer snippet: mount path join and mktemp -t portability #1763

Open

Description

@ptr727

Copilot raised two portability points against catalog/snippets/devcontainer/python/ when it was carried verbatim into ptr727/ESPHome-Config#177. Both were declined there because the fix belongs in the canonical snippet.

  • devcontainer.json mounts: each source joins ${localEnv:HOME}${localEnv:USERPROFILE}. On a Windows host where both are set, for example VS Code launched from Git Bash, the result is an invalid path such as C:\Users\x/c/Users/x/.ssh/..., and the container fails to start.
  • post-create.sh: mktemp -t uv-install.XXXXXX.sh relies on implicit temp-dir selection, and -t behaves differently across mktemp implementations. An explicit template such as "${TMPDIR:-/tmp}/uv-install.XXXXXX.sh" avoids that. It is low risk, since the script only runs inside the Linux container.

The same mount pattern probably appears in the other devcontainer snippets too.

Activity

  1. ptr727 commented on Sep 24, 2026

    @ptr727
    OwnerAuthor

    CodeRabbit raised a third point on the same snippet in ptr727/ESPHome-Config#177:

    • The three bind mounts (~/.ssh/id_ed25519.pub, ~/.config/git/allowed_signers, ~/.config/gh) are required. On a host missing any of them, Docker rejects the mount before onCreateCommand runs, and the container does not start. Make them optional, or document the host paths the container expects.
  2. ptr727 commented on Sep 24, 2026

    @ptr727
    OwnerAuthor

    A third case on the same devcontainer.json mounts, raised by CodeRabbit on ptr727/ESPHome-Config#178: a bind mount fails when its source does not exist on the host, so a contributor with no ~/.ssh/id_ed25519.pub, no ~/.config/git/allowed_signers, or no ~/.config/gh cannot start the container at all.

    Options are to drop the mounts from the default snippet, move them to an opt-in config, or document the host prerequisites beside the snippet.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions