Skip to content

debian: fix VS Code crash via Pango 1.56.x fontconfig workaround#14

Merged
mapitman merged 1 commit intomainfrom
fix/vscode-startup-crash
Mar 15, 2026
Merged

debian: fix VS Code crash via Pango 1.56.x fontconfig workaround#14
mapitman merged 1 commit intomainfrom
fix/vscode-startup-crash

Conversation

@mapitman
Copy link
Owner

Pango 1.56.x introduced a thread pool for font loading ([pango] fontcon threads). When FONTCONFIG_FILE is unset or points directly to /etc/fonts/fonts.conf, these threads hit a stack corruption bug while processing cache-11 entries for variable fonts (Cascadia Code, Fira Code, Cantarell-VF, etc.). The crash manifests as a SIGTRAP from a ud2 instruction, with the stack return address overwritten with 'slotsize' (a HarfBuzz/fontconfig internal field name).

The fix involves three changes:

  1. Rebuild the fontconfig cache (fc-cache -f) after desktop package install to ensure it is up to date and not stale/missing.

  2. Set FONTCONFIG_FILE to a wrapper config that includes /etc/fonts/fonts.conf via rather than pointing at fonts.conf directly. This causes Pango to use a different internal code path that avoids the corrupting write. The wrapper produces identical font enumeration, so no behavior change for end users.

Three activation methods for coverage:

  • ~/.config/environment.d/fontconfig.conf (systemd user session / GNOME)
  • ~/.bashrc export (new terminal sessions)
  • export in the script itself (current bootstrap session)
  1. Apply the same FONTCONFIG_FILE export to .zshrc (in addition to .bashrc), since zsh is the default shell after install-zsh-customizations runs. Without this, users on zsh would not have the variable set in their interactive terminal sessions.

Remove this workaround when Pango >= 1.57 is available in Debian stable. Validated: bash scripts/check.sh passes.

Pango 1.56.x introduced a thread pool for font loading ([pango] fontcon
threads). When FONTCONFIG_FILE is unset or points directly to
/etc/fonts/fonts.conf, these threads hit a stack corruption bug while
processing cache-11 entries for variable fonts (Cascadia Code, Fira Code,
Cantarell-VF, etc.). The crash manifests as a SIGTRAP from a ud2
instruction, with the stack return address overwritten with 'slotsize'
(a HarfBuzz/fontconfig internal field name).

The fix involves three changes:

1. Rebuild the fontconfig cache (fc-cache -f) after desktop package
   install to ensure it is up to date and not stale/missing.

2. Set FONTCONFIG_FILE to a wrapper config that includes
   /etc/fonts/fonts.conf via <include> rather than pointing at fonts.conf
   directly. This causes Pango to use a different internal code path that
   avoids the corrupting write. The wrapper produces identical font
   enumeration, so no behavior change for end users.

Three activation methods for coverage:
- ~/.config/environment.d/fontconfig.conf  (systemd user session / GNOME)
- ~/.bashrc export                          (new terminal sessions)
- export in the script itself               (current bootstrap session)

3. Apply the same FONTCONFIG_FILE export to .zshrc (in addition to
   .bashrc), since zsh is the default shell after install-zsh-customizations
   runs. Without this, users on zsh would not have the variable set in
   their interactive terminal sessions.

Remove this workaround when Pango >= 1.57 is available in Debian stable.
Validated: bash scripts/check.sh passes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mapitman mapitman merged commit 1de00a8 into main Mar 15, 2026
5 checks passed
@mapitman mapitman deleted the fix/vscode-startup-crash branch March 15, 2026 23:10
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.

1 participant