Repository navigation
fix(install): chown docker scaffold output before the git phase - #1245
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause
Closes #1235.
Under
install.sh --docker, the scaffold container runs as root, so itsbind-mounted output (
-v "$PROJECT_PATH:/workspace") lands root-owned on thehost. The host-side git phase (
setup_git_repo) then runs against thatstill-root-owned tree and fails with
.git: Permission denied. That failure iswarn-not-fail by design (CI/fresh-machine friendliness), so the installer
"succeeds" but leaves a root-owned, git-less tree. Before this change there was
no
chownanywhere ininstall.sh(grep -c chown install.sh== 0), so everydocker caller had to repair ownership and
git initby hand — the direnv smokelane (devkit-smoke-test#286, #1194) carries exactly that workaround.
Fix
After the scaffold container run and before the host-side setup (git phase +
run_user_conf), on the docker runtime only, reuse the same image in athrowaway container to chown the tree back to the invoking user:
The host user usually can't chown root-owned files directly, hence the
second container run. Rootless podman already maps container-root to the
invoking user, so its output is correctly owned — the repair is gated on
[ "$RUNTIME" = "docker" ]and skipped for podman. The step is warn-not-fail tomatch the git phase's posture, and it sits after the
--preview/--dry-runearly exits so those paths are unaffected. The warn-not-fail git phase itself is
left untouched as the issue requires.
The smoke-lane workaround is intentionally not touched here (per the issue,
that simplification is a follow-up once this releases).
Test evidence (TDD)
New section in
tests/bats/install.bats(#1235), exercised against a loggingstub runtime:
docker path chowns scaffold output to the invoking user— asserts achown -R <uid>:<gid> /workspacecontainer run is issued on--docker.podman path runs no ownership-repair container— asserts--podmanneverchowns.
ownership repair is ordered before the git phase— structural: the chownblock precedes the
setup_git_repocall in source.RED (test commit
d652f95b): docker + ordering tests fail (no chown present).GREEN (fix commit
49ead96e): all 3 pass; fullinstall.batssuite 102/102 ok.just precommit(fullpre-commit run --all-files): all hooks green.Refs: #1235