Skip to content

fix(init): make devcontainer postCreateCommand robust on Podman-on-Windows (#742)#744

Open
kaspergff wants to merge 1 commit into
mendixlabs:mainfrom
kaspergff:fix/742-devcontainer-file-chmod
Open

fix(init): make devcontainer postCreateCommand robust on Podman-on-Windows (#742)#744
kaspergff wants to merge 1 commit into
mendixlabs:mainfrom
kaspergff:fix/742-devcontainer-file-chmod

Conversation

@kaspergff

Copy link
Copy Markdown

What

Fixes two independent bugs in the devcontainer template generated by mxcli init / mxcli new (cmd/mxcli/tool_templates.go). Both fail the container's postCreateCommand (red error in VS Code) when the workspace is a 9p bind-mount from a Windows drive under Podman — even though the container itself builds and mxcli runs fine.

Closes #742.

Bug 1 — file not installed

postCreateCommand gates the "keep the committed Linux binary" fast-path on file ./mxcli | grep -q Linux, but file was never in the Dockerfile apt list → command not found: file → fast-path never taken, always re-downloads.
Fix: add file to the Dockerfile apt install list.

Bug 2 — unguarded chmod

The download fallback ended in ... && chmod +x ./mxcli. On 9p, Unix permission changes are Operation not permitted; the binary is already -rwxrwxrwx, but the non-zero exit failed the entire postCreateCommand.
Fix: chmod +x ./mxcli 2>/dev/null || true.

Environment reproduced

Windows 11 + WSL2 + Podman 5.8.2, Mendix project on C:\Mendix\..., workspace via 9p, base image mcr.microsoft.com/devcontainers/base:bookworm, mxcli v0.14.0.

Validation

  • make build
  • make test ✅ (no new failures)
  • make lint — Go lint ✅ (TS lint-ts step needs bun, not installed in this env; unrelated)
  • End-to-end: ran mxcli init --container-runtime podman in a scratch dir → generated devcontainer.json parses as valid JSON, postCreateCommand ends with the guarded { chmod +x ./mxcli 2>/dev/null || true; }, Dockerfile apt list contains file, and the extracted postCreateCommand passes bash -n.

Notes

🤖 Generated with Claude Code

…ndows

The devcontainer template generated by `mxcli init`/`new` had two bugs that
failed `postCreateCommand` (red error in VS Code) when the workspace is a 9p
bind-mount from a Windows drive under Podman:

1. `file` was never installed in the image, so `file ./mxcli | grep -q Linux`
   emitted `command not found` and the Linux-binary fast-path was never taken
   (always re-downloaded). Add `file` to the Dockerfile apt list.

2. The download fallback ran an unguarded `chmod +x ./mxcli`, which fails with
   `Operation not permitted` on 9p (Unix perm changes disallowed) and failed
   the whole postCreate even though the binary is already executable. Guard it
   with `2>/dev/null || true`.

Fixes mendixlabs#742

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

init/new: generated devcontainer postCreateCommand fails on Podman-on-Windows (missing file, unguarded chmod)

1 participant