JARVIS

bash-alias-segfault

active

Workspace

global

Created

2026-03-15

Updated

2026-03-15

Content

## Symptoms Any alias that launches a program which internally spawns `bash --posix` (e.g. Claude Code, Rust TUI binaries) can segfault with `Segmentation fault (core dumped)`. ## Root Cause Bash 5.3.9 parser bug. The crash is in `/usr/bin/bash` itself (`yyparse`), not in the program being launched. The exact trigger differs by program type. ## Fix — Rust TUI binaries (mr, mf, mu, mja, cc-top) Wrap with `env -i` to strip the inherited environment: ```bash alias foo='env -i HOME="$HOME" PATH="$PATH" TERM="$TERM" some-rust-binary' ``` Pass additional env vars as needed (e.g. `MR_REPO_ROOT=~/repos`). Applied to: `cc-top`, `mr`, `mf`, `mu`, `mja`. ## Fix — Claude Code (mj) **Do NOT use `env -i` for Claude Code.** Stripping the environment causes Claude's spawned `bash --posix` to crash — likely because Claude Code generates different initialization commands when env vars are missing, and those commands hit the parser bug. Claude Code works fine with the full environment: ```bash alias mj='cd ~/repos/jmn/jmn-16-my-jarvis && claude --dangerously-skip-permissions' ``` ## Evidence - Session started at 03:45 without `env -i` ran for 5+ hours without issues - Two attempts at 09:05 with `env -i` both crashed immediately - Session started at 09:05 without `env -i` worked fine - Core dumps confirm same `yyparse` crash signature in all cases ## Underlying issue `.my-bashrc` generates 300+ functions via nested `eval` loops (lines 144-212). This is the likely trigger for the bash 5.3.9 parser instability. Long-term fix: simplify `.my-bashrc` or update bash when a patched version is available (Arch repos still on 5.3.9-1 as of 2026-03-15).