From 60deab05fc6da9cab1fcfe04ef1ff1f66ef9a41d Mon Sep 17 00:00:00 2001 From: Brandt Kurowski Date: Tue, 9 Jun 2026 09:29:07 -0400 Subject: [PATCH 1/2] Set stable WORKDIR so dotfiles install survives docroot swap (#45) The php base image leaves WORKDIR at /var/www/html, which devcontainer_on_create.sh deletes and replaces with a symlink to the mounted docroot. The devcontainer CLI starts its persistent setup shell ("shellServer") in WORKDIR with no -w flag, so that rm -rf orphans the shell's cwd. The later dotfiles `git clone` runs in the same shellServer and fails its getcwd() with "Unable to read current working directory". The lifecycle commands run as separate execs (-w workspaceFolder), so the cd "$WORKSPACE_FOLDER" added in #48 can't repair the shellServer. Anchoring WORKDIR to /home/vscode keeps the shellServer's cwd valid through the docroot swap. Co-Authored-By: Claude Opus 4.8 --- Dockerfile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Dockerfile b/Dockerfile index 4da5577..d16e8d7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,13 @@ FROM mcr.microsoft.com/devcontainers/php:8.3 +# The php base image sets WORKDIR to /var/www/html, which devcontainer_on_create.sh +# later deletes and replaces with a symlink to the mounted docroot. The devcontainer +# CLI starts its persistent setup shell ("shellServer") in WORKDIR with no -w flag, so +# that deletion orphans the shell's cwd and the subsequent dotfiles `git clone` fails +# with "Unable to read current working directory" (issue #45). Anchor WORKDIR to a +# stable directory that the lifecycle scripts never delete. +WORKDIR /home/vscode + # Change default umask and add user to web group so we can share write permission on web files # Configure pam_umask to set umask to 002 (works regardless of /etc/login.defs content) RUN sed -i 's/pam_umask\.so/pam_umask.so umask=002/' /etc/pam.d/common-session \ From 292fd35ea378f8d5fbf79a3b364418a89d1e3045 Mon Sep 17 00:00:00 2001 From: Brandt Kurowski Date: Tue, 9 Jun 2026 10:41:08 -0400 Subject: [PATCH 2/2] Remove dead shellServer cwd-restore from lifecycle scripts (#45) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The cd "$WORKSPACE_FOLDER" appended to devcontainer_on_create and devcontainer_post_create in #48 was meant to leave the devcontainer CLI's persistent shellServer in a valid cwd before the dotfiles clone. It can't: each lifecycle command runs in its own `/bin/sh -c` exec that exits as soon as the function returns, so the cd never touches the shellServer. The real fix is anchoring the image WORKDIR (prior commit). Kept _cwd_workspace at the top of each script — on_create's docroot symlink (ln -s "$(pwd)/web" ...) depends on a deterministic cwd, so that call is load-bearing, not part of the broken cwd-restore theory. Co-Authored-By: Claude Opus 4.8 --- local/etc/uceap.d/devcontainer_on_create.sh | 3 --- local/etc/uceap.d/devcontainer_post_create.sh | 3 --- 2 files changed, 6 deletions(-) diff --git a/local/etc/uceap.d/devcontainer_on_create.sh b/local/etc/uceap.d/devcontainer_on_create.sh index afa5f3c..8d0ae42 100644 --- a/local/etc/uceap.d/devcontainer_on_create.sh +++ b/local/etc/uceap.d/devcontainer_on_create.sh @@ -93,9 +93,6 @@ function devcontainer_on_create() { if [ -x .devcontainer/onCreate.sh ]; then .devcontainer/onCreate.sh fi - - # Leave the shellServer with a valid cwd for any subsequent step (see issue #45) - cd "$WORKSPACE_FOLDER" } _devcontainer_on_create_desc='runs when the devcontainer is created' diff --git a/local/etc/uceap.d/devcontainer_post_create.sh b/local/etc/uceap.d/devcontainer_post_create.sh index 9090845..f8bba7c 100644 --- a/local/etc/uceap.d/devcontainer_post_create.sh +++ b/local/etc/uceap.d/devcontainer_post_create.sh @@ -29,9 +29,6 @@ function devcontainer_post_create() { if [ -x .devcontainer/postCreate.sh ]; then .devcontainer/postCreate.sh fi - - # Leave the shellServer with a valid cwd for any subsequent step (see issue #45) - cd "$WORKSPACE_FOLDER" } _devcontainer_post_create_desc='runs after the devcontainer is created'