Skip to content

fix: resolve snap bun filesystem confinement breaking setup#92

Open
Zer0phucks wants to merge 1 commit intogarrytan:mainfrom
Zer0phucks:fix/snap-bun-confinement
Open

fix: resolve snap bun filesystem confinement breaking setup#92
Zer0phucks wants to merge 1 commit intogarrytan:mainfrom
Zer0phucks:fix/snap-bun-confinement

Conversation

@Zer0phucks
Copy link

Problem

On Linux systems where bun is installed via snap, ./setup fails with cryptic errors:

  • EACCES: Permission denied while opening package.json — snap sandbox blocks file access under ~/.claude/
  • CouldntReadCurrentDirectorybun run <script> hits the same confinement wall
  • Same errors with bunx playwright install chromium

Snap apps run in a constricted sandbox that restricts filesystem access to approved paths. The ~/.claude/ directory is not in that list.

Fix

  1. Resolve bun at setup start — prefer ~/.bun/bin/bun (the official installer's target) over whatever bun is in $PATH. Falls back to PATH bun if ~/.bun/bin/bun doesn't exist, so non-snap installs are unaffected.

  2. Inline the build steps instead of using bun run buildbun run fails with CouldntReadCurrentDirectory even with the non-snap bun on some Linux setups. The inlined commands (bun scripts/gen-skill-docs.ts, bun build --compile ...) work correctly.

  3. Replace bunx with "$BUN" x for the Playwright install step.

Test plan

  • Fresh setup on a system with snap bun in PATH and ~/.bun/bin/bun also installed → uses ~/.bun/bin/bun, succeeds
  • Setup on a system with only non-snap bun → falls back to PATH bun, unaffected
  • bunx playwright install chromium path → replaced with "$BUN" x, no snap confinement issue

🤖 Generated with Claude Code

Bun installed via snap runs in a sandbox that blocks access to files
outside approved paths (including ~/.claude/). This causes:
- EACCES on `bun install` (can't read package.json)
- CouldntReadCurrentDirectory on `bun run <script>`
- Same errors with `bunx`

Fix: resolve bun at setup start, preferring ~/.bun/bin/bun (the
official installer target) over whatever is in PATH. Fall back to
PATH bun if ~/.bun/bin/bun doesn't exist.

Also inline the build steps that `bun run build` would have invoked,
since `bun run` fails with CouldntReadCurrentDirectory even with the
non-snap bun on some Linux setups.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 16, 2026 07:49
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves ./setup reliability on Linux systems where bun is installed via snap (and is subject to filesystem confinement), by explicitly selecting a non-snap bun binary and avoiding bun run/bunx paths that can fail under confinement.

Changes:

  • Resolve bun at the start of setup, preferring ~/.bun/bin/bun over the bun found in $PATH.
  • Inline the build steps instead of using bun run build.
  • Replace bunx playwright ... with "$BUN" x playwright ....

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +13 to +15
BUN="$(command -v bun)"
fi

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.

2 participants