From 6c25496bc8bcd72bb41fc72edcca746af50f48ed Mon Sep 17 00:00:00 2001 From: Brandon Corbett Date: Tue, 20 Oct 2026 17:21:09 -0400 Subject: [PATCH] test(quickstart): fail when the project cannot be removed without root On a Linux host the dev containers run as root over bind mounts, so a file they write into the project leaves it undeletable without sudo. Tear the stack down and remove the project as part of the run, and list the root-owned paths when that fails, rather than hiding them behind the cleanup fallback. --- scripts/quickstart-clean-run.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/scripts/quickstart-clean-run.sh b/scripts/quickstart-clean-run.sh index 331fa03..cff7419 100755 --- a/scripts/quickstart-clean-run.sh +++ b/scripts/quickstart-clean-run.sh @@ -39,8 +39,8 @@ cleanup() { fi (cd "$APP_DIR" && docker compose down -v --rmi local --remove-orphans >/dev/null 2>&1) || true fi - # On Linux the api container runs as root over the bind-mounted api/, so files it - # wrote (api/logs) are root's. Removing them from a container needs no sudo. + # Only for a run that failed before the removal check below. Files a container + # wrote as root over a bind mount can still be removed from a container. if ! rm -rf "$WORKDIR" 2>/dev/null; then docker run --rm -v "$WORKDIR:/w" alpine:3 rm -rf /w/my-app >/dev/null 2>&1 || true rm -rf "$WORKDIR" || true @@ -124,6 +124,16 @@ end_phase "Owner signed in through /auth" total=$(($(date +%s) - run_start)) +# On a Linux host the dev containers run as root over bind mounts, so anything they +# write into the project is root's, and a user cannot delete the project without sudo. +echo "==> Removing the project" +docker compose down -v --rmi local --remove-orphans >/dev/null 2>&1 +cd "$WORKDIR" +if ! rm -rf "$APP_DIR"; then + find "$APP_DIR" -user 0 >&2 || true + fail "the project could not be removed without root. The files above were written by a container." +fi + { echo "### Quickstart clean run: $CLI ($cli_version)" echo