1
0
Fork 0

Fix font check: pipefail + grep -q returns SIGPIPE 141

The bootstrap script has 'set -euo pipefail' at the top. The font
check was 'fc-list 2>/dev/null | grep -qi "Maple Mono NF"'. With
pipefail enabled, this fails:

1. grep -q exits 0 as soon as it finds the first match
2. grep closing its stdin early sends SIGPIPE to fc-list
3. fc-list exits with 141 (SIGPIPE)
4. With pipefail, the pipeline returns 141, not 0
5. The 'if' evaluates 141 as false → NO-MATCH
6. Bootstrap re-installs the font even though it's already there

Discovered on kaiser: bootstrap kept failing at 'paru -S maplemono-nf-cn'
because the font was already installed but the check said it wasn't.

Fix: use bash string matching instead of a pipeline.
  [[ "$(fc-list 2>/dev/null)" == *"Maple Mono NF"* ]]

This reads all output into a string (no pipe), then bash's built-in
glob match handles the test. No pipefail issue.
This commit is contained in:
Rain 2026-06-21 23:20:40 -04:00
parent 20639f31f9
commit d537a5b577

View file

@ -157,7 +157,11 @@ fi
# Pin Maple-font version. Bump manually if a release breaks things. # Pin Maple-font version. Bump manually if a release breaks things.
MAPLE_FONT_VERSION="v7.9" MAPLE_FONT_VERSION="v7.9"
if fc-list 2>/dev/null | grep -qi "Maple Mono NF"; then # fc-list check: bash string match instead of pipeline, because `set -o pipefail`
# in this script causes `fc-list | grep -q` to fail with SIGPIPE (exit 141) when
# grep exits early on first match — the pipeline then reports non-zero, the
# `if` evaluates to false, and the bootstrap re-installs the font unnecessarily.
if [[ "$(fc-list 2>/dev/null)" == *"Maple Mono NF"* ]]; then
log "Maple Mono NF already installed" log "Maple Mono NF already installed"
else else
{{ if eq .os_family "arch" -}} {{ if eq .os_family "arch" -}}