I need to understand some cmds of tex

Running TeX with the -ini flag means that you're running without any preloaded format. You don't get anything but primitive commands which means that \ and \& aren't defined. So that's why you're getting the errors. Do you really want to be running iniTeX?

i means insert the text following at the point that the error occurred. x is the usual quit command. e in theory will stop and then open an editor at the error point. I'm guessing this is missing some implementation/configuration which is why you're getting the segmentation fault. These are just some of the interactive error handling commands that TeX provides. See The TeXbook for more information about how these work. I've never really bothered with them. They made a lot of sense in the early 80s when computers were slow and compute time expensive but even by 1986 when I first started using TeX the program ran fast enough that it was generally more sensible to just use x to stop TeX, fix the error in the input file and continue.


Congratulations, you have found the bug in TeX.

Edit I did deeper inspection about this issue when I returned from my vacation and I found: the bug is in the C implementation of TeX, not in the TeX itself (coded by D. Knuth). So, the following paragraph (given by me a few days ago) is not explicitly true:

The last revision of TeX (version 3.14159265) was done by D. Knuth in 2014, next revision will be in the end of 2020. If you send this bug-report you can get a check for a small piece in dollars by D. Knuth. Of course, this is true only if your bug report will be processed as real bug of TeX. How to do the bug report is described at here in section Errata.

Description of the bug: If we invoke an error (undefined \ in your example), then the I option is possible. If we use I option with a line with next error (undefined \& in your example) and the I line is not closed at this place (the V follows in your example) then this second error offers all options including E option. But using E option causes that TeX crashes, because the file name is zero in this case.

In detail: I option in § 84 of TeX web runs the code from § 87 where the procedure begin_file_reading is processed. This procedure is in § 328 and here is: name := 0. The name is macro defined in § 302: name = cur_input.name_field. Now, we can return to § 84 where the E option is solved. It creates the file name (which may be sent to an editor) from input_stack[base_ptr].name_field but this is the same as cur_input.name_field and it was set to zero. We have no file name here but zero. TeX implementation based on C crashes with segmentation fault because we want to open the file with buggy file name.

Edit: When I did experiments with tex.web code and I deactivated the system dependent code given after E option then the correct answer is here: You want to edit file <correct name> at line <correct number>. The bug is in the lib/texmfmp.c at line 2579 where the opened files are closed and the maximal index of opened files are read from inopen global variable. This variable is incremented when I option is used but no new file is opened in such case. So, we cannot close non-existent file in lib/texmf.c. Knuth says in §304: "The global variable in_open is equal to the value of the highest non-token-list level." It means that it is not always the number of currently opened files. Knuth's code and his comments in the code are correct here, bug is in the system dependent implementation.


Original poster: as with your other report ... if you ever see this, please email me, karl at tug.org, so we can give you proper credit in our report to Don Knuth. (We believe there is a bug in tex.web as well as in web2c; the tex.web code can be induced to print a bogus filename in the "You want to edit ..." message.)

Regarding begin_file_reading, it is, shall we say, suboptimally named. What it really does is "begin a level of input" - either from a file or from terminal interaction.

I just committed a fix (hopefully) for this to TeX Live, r55857 (http://tug.org/svn/texlive/trunk/Build/source/texk/web2c/lib/texmfmp.c?r1=53078&r2=55857&pathrev=55857). It involves having to look at all elements of input_stack[] to discern whether a given entry in input_file[] is actually a file, or a non-file resulting from terminal interaction. Before, we simply closed everything in input_file[], but that was wrong.

Regarding "the end of this year" - please send any and all Knuthian bug reports to me or tex-k at tug.org as soon as possible! Do not wait for December 31. My unofficial deadline is November 1. All reports have to be vetted before they go into the pile for Knuth, and it takes time. More info: https://tug.org/texmfbug.

Thanks to all.