Skip to content

fix(gbrain-install): skip postinstall scripts on Windows MSYS/Cygwin#1487

Closed
genisis0x wants to merge 1 commit into
garrytan:mainfrom
genisis0x:fix/1271-bun-install-windows-postinstall
Closed

fix(gbrain-install): skip postinstall scripts on Windows MSYS/Cygwin#1487
genisis0x wants to merge 1 commit into
garrytan:mainfrom
genisis0x:fix/1271-bun-install-windows-postinstall

Conversation

@genisis0x
Copy link
Copy Markdown

Summary

Fixes #1271 (quirk 1): gstack-gbrain-install aborts on Windows MSYS/Cygwin shells because bun install runs gbrain's native postinstall script, which mis-parses Windows-style path arguments and exits non-zero. The package itself installs cleanly without scripts, so this PR detects Windows shells (uname -s matches MINGW*|MSYS*|CYGWIN*|Windows_NT) and passes --ignore-scripts to bun install on those platforms only. macOS and Linux paths are untouched.

The follow-up bun link step is unaffected by --ignore-scripts (link runs its own lifecycle), so the resulting gbrain CLI on PATH still works as before. D19 PATH-shadow validation downstream of the install also continues to apply unchanged.

Scope

  • One file: bin/gstack-gbrain-install
  • One concern: Windows shell detection + conditional flag
  • No behavior change for macOS / Linux

Issue #1271 lists three quirks; this PR addresses only quirk 1. The remaining two (path normalization in ~/.bashrc append, and ttyd/screen probe on Git-bash) are out of scope here.

Test plan

  • macOS shell: bash bin/gstack-gbrain-install --dry-run still prints expected plan (no change)
  • macOS shell: full install path still runs bun install --silent (no --ignore-scripts)
  • Simulate MSYS by spoofing uname -s: confirm bun install --silent --ignore-scripts branch is taken
  • Bash -n syntax check passes (verified locally)

bun install in  fails on Windows MSYS/Cygwin shells because
gbrain's native postinstall script mis-parses path arguments and aborts
with a non-zero exit, breaking gstack-gbrain-install for Windows users
running git-bash/MSYS2. The package installs cleanly without scripts.

Detect MINGW/MSYS/CYGWIN/Windows_NT via uname -s and pass --ignore-scripts
to bun install on those shells. macOS and Linux paths unchanged.

Refs garrytan#1271
@genisis0x genisis0x force-pushed the fix/1271-bun-install-windows-postinstall branch from 4fd4efe to 7e27fef Compare May 15, 2026 10:35
@genisis0x
Copy link
Copy Markdown
Author

Rebased on latest main to clear stale-against-1.38.0.0. Worth flagging this PR is scope-distinct from the v1.38.0.0 Windows install hardening that just landed in #1505:

Different file, different failure mode, no overlap with the symlink invariant test/setup-windows-fallback.test.ts enforces. Still ready for review.

@garrytan
Copy link
Copy Markdown
Owner

Thank you @genisis0x. Cherry-picked into v1.40.0.0 with attribution preserved (Author: genisis0x). Extended with a post-install gbrain sources --help probe + Windows-specific remediation message. See commit c9b24d2. Consolidated v1.40.0.0 fix wave lands as PR #1547. Closing this one as superseded — your contribution is recognized in CHANGELOG.md and the commit metadata.

@garrytan garrytan closed this May 16, 2026
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.

Windows MSYS install: 3 quirks in /setup-gbrain skill (gbrain v0.18.2)

2 participants