Summary #
In nix/package.nix, the mkStaticGrammar function runs ar crs libparser.a *.o 2>/dev/null || true. If the archive creation fails (e.g., no .o files), the error is hidden, and the subsequent linker invocation fails with a missing file.
The Problem #
The || true clause causes non-zero exit codes from ar to be ignored, so a failed archive creation goes undetected. If a grammar's compilation failed before postBuild (though unlikely), or if the glob expands to zero files, ar would fail silently, leading to a confusing linker error later.
Impact #
- category: correctness
- description: silent ar failure in grammar archive creation hides build errors; missing .o glob causes linker error later
Recommended Fix #
Replace the silent swallow with an explicit check: ar crs libparser.a *.o; if [ ! -f libparser.a ]; then echo 'error creating static archive'; exit 1; fi
Commit range: b0473de..b0473de
Code Review: CR-2026-07-27-11