From 6644666cb14f6283eb82339c21b3e4bd4613a936 Mon Sep 17 00:00:00 2001 From: rain Date: Tue, 23 Jun 2026 20:31:33 -0400 Subject: [PATCH] Font install check: anchor to exact family 'Maple Mono NF' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous substring check (*"Maple Mono NF"* glob / grep -q substring) matched 'Maple Mono NF CN' too, which silently skipped the Latin-only NF install on boxes that had only the CJK variant installed (byte, kaiser — they shipped with maple-font system package that defaults to NF CN). Result: foot (and any other config asking for 'Maple Mono NF') silently fell back to system sans on byte and kaiser, while looking like a working terminal. Compounded by foot.ini asking for 'Maple Mono CN' (see prior commit c6779c5), which masked the missing NF install on miche (which has both CN and NF). Fix: use fc-list : family | grep -qxF 'Maple Mono NF' which: - prints one family per line (no style suffixes to confuse grep) - -x anchors whole line - -F fixed string (no regex) - matches exactly 'Maple Mono NF' and nothing else Why not fc-match? fc-match reports a substitute when the family isn't installed (Noto/Liberation/DejaVu depending on distro), so it can't distinguish 'NF installed' from 'NF not installed, fell back'. Verified on byte: fc-list : family | grep -qxF 'Maple Mono NF' returns 1 (false) because byte has only 'Maple Mono NF CN', so the install will now run on next chezmoi apply. --- ...once_20-install-user-packages-gentoo.sh.tmpl | 4 +++- run_once_20-install-user-packages.sh.tmpl | 17 ++++++++++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/run_once_20-install-user-packages-gentoo.sh.tmpl b/run_once_20-install-user-packages-gentoo.sh.tmpl index ff98e84..21f8f71 100644 --- a/run_once_20-install-user-packages-gentoo.sh.tmpl +++ b/run_once_20-install-user-packages-gentoo.sh.tmpl @@ -263,7 +263,9 @@ else fi # Step 9: Maple Mono NF font -if ! fc-list | grep -qi "Maple Mono NF"; then +# Match EXACT family "Maple Mono NF", not "Maple Mono NF CN" or other variants. +# See run_once_20-install-user-packages.sh.tmpl for the rationale. +if ! fc-list : family 2>/dev/null | grep -qxF 'Maple Mono NF'; then log "installing Maple Mono NF font" # Download the latest release zip TMPFONT=$(mktemp -d) diff --git a/run_once_20-install-user-packages.sh.tmpl b/run_once_20-install-user-packages.sh.tmpl index 300b1be..1a076f9 100755 --- a/run_once_20-install-user-packages.sh.tmpl +++ b/run_once_20-install-user-packages.sh.tmpl @@ -290,11 +290,18 @@ fi # Pin Maple-font version. Bump manually if a release breaks things. MAPLE_FONT_VERSION="v7.9" -# 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 +# fc-list check: must match the EXACT family "Maple Mono NF", not substrings. +# `*Maple Mono NF*` glob / `grep -q "Maple Mono NF"` substring matches would also +# match "Maple Mono NF CN" (the CJK variant) and incorrectly skip the install. +# byte and kaiser both have system-wide `MapleMono-NF-CN` from a maple-font +# package install but no Latin-only `MapleMono-NF`, and the substring check +# silently let that slide. Use `fc-list : family` to print one family per line +# (no style suffixes), `grep -qxF` to match the exact whole line. +# +# Why not `fc-match "Maple Mono NF"`? fc-match reports a substitute if the family +# isn't installed (falls back to system sans), so it can't distinguish "NF +# installed" from "NF not installed, fell back to Noto/Liberation/DejaVu". +if fc-list : family 2>/dev/null | grep -qxF 'Maple Mono NF'; then log "Maple Mono NF already installed" else {{ if eq .os_family "arch" -}}