From 9f67b776b08a2aaf2dc7d14bac2f32220afb7f4f Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 29 Sep 2022 01:20:56 +0000 Subject: protect against recursive --halt-on-error git-svn-id: svn://tug.org/texlive/trunk@64547 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/web2c/ChangeLog | 11 +++++++++++ Build/source/texk/web2c/mf.ch | 14 +++++++++++++- Build/source/texk/web2c/tex.ch | 14 +++++++++++++- 3 files changed, 37 insertions(+), 2 deletions(-) (limited to 'Build/source/texk/web2c') diff --git a/Build/source/texk/web2c/ChangeLog b/Build/source/texk/web2c/ChangeLog index 060c738ca8f..ae04242326c 100644 --- a/Build/source/texk/web2c/ChangeLog +++ b/Build/source/texk/web2c/ChangeLog @@ -1,3 +1,14 @@ +2022-09-28 Karl Berry + + * tex.ch (halting_on_error_p): new variable, set when we start to + halt_on_error, and exit immediately if seen again. + * mf.ch: likewise. + (The cause is that close_files_and_terminate tries to close out + the dvi file nicely, which includes figuring out the + magnification, so if the magnification is already set, there's a + "recursive" error, which caused an infloop.) + Report from Bachir Bendrissou, tlsecurity 28 Sep 2022 12:28:10. + 2022-09-03 TANAKA Takuji * bibtex.ch: diff --git a/Build/source/texk/web2c/mf.ch b/Build/source/texk/web2c/mf.ch index abe01851d93..1f34a479aff 100644 --- a/Build/source/texk/web2c/mf.ch +++ b/Build/source/texk/web2c/mf.ch @@ -207,6 +207,7 @@ tini@/ @!file_line_error_style_p:c_int_type; {output file:line:error style errors.} @!eight_bit_p:c_int_type; {make all characters printable by default} @!halt_on_error_p:c_int_type; {stop at first error} +@!halting_on_error_p:boolean; {already trying to halt?} @!quoted_filename:boolean; {current filename is quoted} @z @@ -675,7 +676,12 @@ print_char("."); show_context; @y print_char("."); show_context; if (halt_on_error_p) then begin - history:=fatal_error_stop; jump_out; + {If |close_files_and_terminate| generates an error, we'll end up back + here; just give up in that case. If files are truncated, too bad.} + if (halting_on_error_p) then do_final_end; {quit immediately} + halting_on_error_p:=true; + history:=fatal_error_stop; + jump_out; end; @z @@ -1983,9 +1989,15 @@ Here are the variables used to hold ``switch-to-editor'' information. @ The |edit_name_start| will be set to point into |str_pool| somewhere after its beginning if \MF\ is supposed to switch to an editor on exit. +Initialize the |stop_at_space| variable for filename parsing. + +Initialize the |halting_on_error_p| variable to avoid infloop with +\.{--halt-on-error}. + @= edit_name_start:=0; stop_at_space:=true; +halting_on_error_p:=false; @ Dumping the |xord|, |xchr|, and |xprn| arrays. We dump these always in the format, so a TCX file loaded during format creation can set a diff --git a/Build/source/texk/web2c/tex.ch b/Build/source/texk/web2c/tex.ch index 30d3b5044ad..60c4f8f1aaa 100644 --- a/Build/source/texk/web2c/tex.ch +++ b/Build/source/texk/web2c/tex.ch @@ -575,6 +575,7 @@ tini@/ @!file_line_error_style_p:cinttype; {format messages as file:line:error} @!eight_bit_p:cinttype; {make all characters printable by default} @!halt_on_error_p:cinttype; {stop at first error} +@!halting_on_error_p:boolean; {already trying to halt?} @!quoted_filename:boolean; {current filename is quoted} {Variables for source specials} @!src_specials_p : boolean;{Whether |src_specials| are enabled at all} @@ -875,7 +876,12 @@ print_char("."); show_context; @y print_char("."); show_context; if (halt_on_error_p) then begin - history:=fatal_error_stop; jump_out; + {If |close_files_and_terminate| generates an error, we'll end up back + here; just give up in that case. If files are truncated, too bad.} + if (halting_on_error_p) then do_final_end; {quit immediately} + halting_on_error_p:=true; + history:=fatal_error_stop; + jump_out; end; @z @@ -4494,9 +4500,15 @@ system-dependent section allows easy integration of Web2c and e-\TeX, etc.) @ The |edit_name_start| will be set to point into |str_pool| somewhere after its beginning if \TeX\ is supposed to switch to an editor on exit. +Initialize the |stop_at_space| variable for filename parsing. + +Initialize the |halting_on_error_p| variable to avoid infloop with +\.{--halt-on-error}. + @= edit_name_start:=0; stop_at_space:=true; +halting_on_error_p:=false; @ These are used when we regenerate the representation of the first 256 strings. -- cgit v1.2.3