Fix font fallback crashing lualatex on recent TeX Live#14560
Open
cderv wants to merge 3 commits into
Open
Conversation
On recent TeX Live (luaotfload v3.29), setting a font fallback (mainfontfallback/monofontfallback/...) crashes LuaLaTeX before a PDF is produced: luaotfload's fallback resolver dereferences a nil font. Quarto only showed a generic "compilation failed" with no usable signal, because the crash is a Lua runtime error with no standard "! ...Here is how much" block for the log parser to key off. Detect the crash signature in findLatexError and return a message that names the fallback options, explains it is a known upstream luaotfload bug on this TeX Live, and points to the single-font workaround. Upstream report: latex3/luaotfload#331 See #14553.
Collaborator
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
luaotfload appends a ";-fallback" feature to every font name passed to
add_fallback() (to disable recursion). Its request grammar only ends a
font name at ":", "(" or "/", so a bare name like "DejaVu Sans" absorbs
the appended ";-fallback" into the name itself: the lookup fails,
define_font returns nil, and LuaLaTeX crashes dereferencing it
(luaotfload-fallback.lua: attempt to index a nil value). Terminating
each fallback name with ":" lets the appended feature parse as a feature
rather than part of the name, so the fallback resolves and the document
compiles.
This is what made mainfontfallback/sansfontfallback/monofontfallback
crash rather than fill in missing glyphs on recent TeX Live.
See latex3/luaotfload#331
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a document sets a font fallback (
mainfontfallback,monofontfallback, ...) and renders to PDF with lualatex on recent TeX Live (luaotfload v3.29), lualatex crashes before producing a PDF and Quarto reports only a genericcompilation failed- error.Root Cause
luaotfload appends an internal
;-fallbackfeature to each fallback name and resolves it withdefine_font. Its font-name parser ends a name only at:,(or/, so a bare name like"DejaVu Sans"absorbs the appended feature (DejaVu Sans;-fallback), the lookup fails,define_fontreturnsnil, andluaotfload-fallback.luathen dereferences thenil. The template insrc/resources/formats/pdf/pandoc/font-settings.latexemitted fallback names without a trailing colon.Because the crash is a Lua runtime error with no
! ...Here is how muchblock,findLatexErrorinsrc/command/render/latexmk/parse-error.tsextracted nothing, leaving the user with a generic failure and no signal.Fix
Emit each fallback name colon-terminated (
"DejaVu Sans:") so the appended;-fallbackparses as a feature rather than part of the name. The fallback then resolves and the document compiles. A luaotfload maintainer confirmed the colon form as correct in latex3/luaotfload#331.The crash-detection diagnostic in
parse-error.tsis kept as a safety net: if a fallback crash is still detected (e.g. a hand-written raw-LaTeX fallback),findLatexErrorreturns an actionable message instead of a generic failure.Pandoc's template emits colon-less names the same way; reported upstream at jgm/pandoc#11678.
Test Plan
monofont+ multiplemonofontfallbackentries on lualatex (TeX Live 2026) — compiles with fallbacks active, no crashtests/docs/smoke-all/2026/06/01/14553.qmdverifies the generated LaTeX emits colon-terminated fallback names and compilestests/unit/latexmk/parse-error.test.tscovers the crash-log signature for the diagnostic safety netFixes #14553