From 287363e68b5cd50d54d489d5feb8cfce0563e9ce Mon Sep 17 00:00:00 2001 From: Max <99250518+maxib0n@users.noreply.github.com> Date: Wed, 8 Jul 2026 02:48:12 +0200 Subject: [PATCH] ghostty: link against system fontconfig to fix crashes Ghostty statically bundles its own copy of fontconfig, and because the resulting binary is a PIE executable built without hiding those symbols, it globally exports ~27 Fc* functions. GTK4/Pango load the system libfontconfig.so.1 into the same process. Due to ELF symbol interposition, calls made from inside libfontconfig.so.1 (and other GTK-side consumers, e.g. glycin's SVG loader per ghostty-org/ghostty discussion #12555) get redirected to Ghostty's bundled copy instead, corrupting state shared between the two fontconfig instances. This causes reproducible SIGSEGV/SIGABRT crashes (double free / invalid free in FcPatternDestroy, FcFontSetDestroy, or segfaults in FcFontSort), most easily triggered by moving a Ghostty window between monitors with different scale factors, which forces a font grid rebuild through fontconfig. Passing -fsys=fontconfig makes Ghostty dynamically link the system fontconfig instead of statically bundling its own, leaving a single fontconfig instance in the process. Verified locally: the resulting binary exports zero Fc* symbols (down from 27), lists libfontconfig.so.1 as a proper NEEDED entry, and no longer crashes under repeated monitor moves that reliably crashed the unpatched build. --- ghostty/ghostty.spec | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ghostty/ghostty.spec b/ghostty/ghostty.spec index 5b56405..401af4c 100644 --- a/ghostty/ghostty.spec +++ b/ghostty/ghostty.spec @@ -1,6 +1,6 @@ Name: ghostty Version: 1.3.1 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Fast, feature-rich, and cross-platform terminal emulator that uses platform-native UI and GPU acceleration @@ -67,7 +67,8 @@ DESTDIR=%{buildroot} zig build \ -Dpie=true \ -Dstrip=false \ -Demit-docs \ - -Demit-themes=true + -Demit-themes=true \ + -fsys=fontconfig %if 0%{?fedora} >= 42 rm -f "%{buildroot}%{_prefix}/share/terminfo/g/ghostty"