Make rootfs hook chown best-effort for macOS support#7
Merged
Conversation
After each session, per-VM log directories at ~/.config/broodbox/vms/<name>/ persist indefinitely when the process crashes or is killed. The data/ subdirectory is cleaned by propolis via WithCleanDataDir(), but the parent directory and broodbox.log accumulate as orphans. Add PID-sentinel-based cleanup following the exact pattern from CleanupStaleSnapshots: write a .bbox-sentinel file when creating the log directory, then scan for stale directories on CLI startup where the owning process has died. Extract isProcessAlive into a shared internal/infra/process package so both workspace snapshot cleanup and VM log cleanup use the same implementation without duplication. Closes #5 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace os.Chown with bestEffortLchown in InjectGitConfig and InjectMCPConfig hooks. On macOS, non-root users cannot chown files to a different UID, causing VM startup to fail with EPERM. bestEffortLchown uses os.Lchown (symlink-safe) and swallows permission errors. The guest init in propolis now handles authoritative ownership fixup at boot time as PID 1. Depends on stacklok/go-microvm#7. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
bestEffortLchownwrapper that usesos.Lchown(symlink-safe) and swallows EPERMos.ChownwithbestEffortLchowninInjectGitConfigandInjectMCPConfighooksOn macOS, non-root users cannot
os.Chownto a different UID, causing VM startup to fail. The guest init now handles authoritative ownership fixup as PID 1, so the host-side chown only needs to be best-effort.Test plan
task fmt && task lint && task testpassesrecordingChowntests pass unchanged (mock returns nil)Depends on: stacklok/go-microvm#7
🤖 Generated with Claude Code