Skip to main content

salvage_pending_box_lists

Function salvage_pending_box_lists 

Source
pub fn salvage_pending_box_lists(drop_innermost: bool) -> Vec<Digested>
Expand description

Recover the boxes a failed digest_next_body left stranded, in document order, and reset the accumulation stack.

digest_next_body accumulates into box_list (with outer levels suspended on localized_box_list) and only hands them back via expire_local_box_list on the SUCCESS path — so a mid-body Fatal drops every box digested during that call. digest_internal is written to keep partial output after a recoverable Fatal (“Perl finishDigestion L219-220: loop consuming input even after errors”), but that intent was defeated whenever the failure landed in the FIRST body: the caller’s boxes was still empty, so the run produced a 39-byte empty document instead of the text preceding the bad construct. Witness arXiv:2508.07407 (ar5iv #556) — its whole document was lost, though only one \tikz picture is pathological.

drop_innermost is for the runaway guards (Stomach:Recursion), where the innermost level IS the pathology — a 50k-box repeating window. Salvaging it would graft the garbage into the document, so drop that level and keep the suspended outer ones, which is precisely “drop the offending construct, keep the document”. For every other recoverable Fatal the current level is honest content and is kept.