tectonic icon indicating copy to clipboard operation
tectonic copied to clipboard

Unknown package results in error: terminal input forbidden

Open jnnks opened this issue 3 years ago • 11 comments

The following minimal sample results in the mentioned error using tectonic -X build:

\documentclass{article}

\usepackage{dfdfdfdf}

\begin{document}
hello
\end{document}

When removing the \usepackage command it compiles.

Since the package cannot be found, it's expected that no document is compiled, but the error message can be improved.

Tectonic Version: 0.5.2

jnnks avatar Jun 22 '21 19:06 jnnks

Thanks for the report! Indeed, we should provide a better error message here. This might only be possible with a patch to the TeXLive code, but such patches are going to become necessary sooner or later ...

pkgw avatar Jul 01 '21 13:07 pkgw

I appreciate the project and would like to provide something instead of just complain :) I will have time to concentrate on the topic in a few weeks, what needs to be done until then?

(Issue can be closed from my side, as fix will take a long time)

jnnks avatar Jul 01 '21 20:07 jnnks

Thanks for volunteering! I'd like to keep this issue open to keep track of this issue for the time being.

While the issue is fairly straightforward, I think it will take some fairly in-depth technical work to decide how best to solve it. I think that the first step would be to trace through the LaTeX source code to understand where the request for terminal input is coming from — which would involve digging though lots of low-level TeX code. Not everyone's idea of fun ...

pkgw avatar Jul 02 '21 14:07 pkgw

This seems to also happen when you try to \input a nonexistant file, e.g. this gives error: terminal input forbidden

\documentclass{article}
\begin{document}
\input{missing.tex}
\end{document}

It looks like the error is coming from \@missingfileerror here: https://github.com/latex3/latex2e/blob/43065449eb954a1170340ec4b75e145619cf289a/base/ltfiles.dtx#L1413-L1418

\gdef\@missingfileerror#1#2{%
     \typeout{^^J! LaTeX Error: File `#1.#2' not found.^^J^^J%
      Type X to quit or <RETURN> to proceed,^^J%
      or enter new name. (Default extension: #2)^^J}%
     \message{Enter file name: }%
      {\endlinechar\m@ne
       \global\read\m@ne to\@gtempa}%
...

And LaTeX overrides \input to emit it here: https://github.com/latex3/latex2e/blob/43065449eb954a1170340ec4b75e145619cf289a/base/ltfiles.dtx#L1302

\def\input{\@ifnextchar\bgroup\@iinput\@@input}
...
\def\@iinput#1{%
  \InputIfFileExists{#1}{}%
  {\filename@parse\@curr@file
   \edef\reserved@a{\noexpand\@missingfileerror
     {\filename@area\filename@base}%
     {\ifx\filename@ext\relax tex\else\filename@ext\fi}}%
...

ralismark avatar Jul 11 '21 09:07 ralismark

Thanks, that's very helpful! My current vision for this sort of thing is that the default bundle will basically have to patch LaTeX/TexLive in the bundle to change \@missingfileerror into something that triggers a Tectonic-specific error-reporting builtin. It feels a bit gross but I think that I'd prefer to customize the bundle rather than trying to patch the code on-the-fly, or whatever.

pkgw avatar Jul 13 '21 14:07 pkgw

Another tip to workaround the issue is to run with "-p" to print engine messages and identify the offending package, then act upon.

paulomach avatar Sep 02 '21 18:09 paulomach

@paulomach, oh man, this tip is amazing!! Instead of

error: terminal input forbidden

I now get

error: terminal input forbidden
Error producing PDF.
! LaTeX Error: File `foobar.tex' not found.

which is an error I can actually work with. Thanks so much!

rikhuijzer avatar Sep 22 '21 18:09 rikhuijzer

Hey @jnnks, can you run your file with the above mentioned -p flag, along the lines of tectonic -p --keep-logs test-file.tex and report the results back so we can see why this issue is being caused?

Neved4 avatar Oct 21 '21 09:10 Neved4

Hi @mnrvwl, sorry for the late reply. With the sample code provided in the OP I get the following:

Terminal

Running TeX ...
(test.tex
LaTeX2e <2020-02-02> patch level 5
L3 programming layer <2020-03-06> (article.cls
Document Class: article 2019/12/20 v1.4l Standard LaTeX document class
(size10.clo))

! LaTeX Error: File `dfdfdfdf.sty' not found.

Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)

Enter file name: Writing `test.log` (650 B)
error: terminal input forbidden
test.log

**
(test.tex
LaTeX2e <2020-02-02> patch level 5
L3 programming layer <2020-03-06> (article.cls
Document Class: article 2019/12/20 v1.4l Standard LaTeX document class
(size10.clo
File: size10.clo 2019/12/20 v1.4l Standard LaTeX file (size option)
)
\c@part=\count163
\c@section=\count164
\c@subsection=\count165
\c@subsubsection=\count166
\c@paragraph=\count167
\c@subparagraph=\count168
\c@figure=\count169
\c@table=\count170
\abovecaptionskip=\skip47
\belowcaptionskip=\skip48
\bibindent=\dimen134
)

! LaTeX Error: File `dfdfdfdf.sty' not found.

Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)

Enter file name: 

jnnks avatar Nov 14 '21 20:11 jnnks

@jnnks No worries! As you can see -p is tectonic's verbose mode and it shows what's happening in a less obscure way. I also believe we should have a better error message there, so the issue can remain open to track the improvements on output messages.

Just wanted to make sure you were aware of this option in case that it helps your workflow and saves some headaches ✌🏻😉

Neved4 avatar Nov 15 '21 12:11 Neved4

Thanks :) I did not have the opportunity to use tectonic in a meaningful manner again yet. Next time I will definitely add the flag to my workflow!

jnnks avatar Nov 16 '21 17:11 jnnks

Hey @jnnks, this is the current output of a missing package as of tectonic 0.11, how do you like it? 💜

$ tectonic test.tex
Running TeX ...
error: test.tex:4: ! LaTeX Error: File `dfdfdfdf.sty' not found.
error: halted on potentially-recoverable error as specified

Neved4 avatar Oct 05 '22 09:10 Neved4

@mnrvwl Very nice, thanks for letting me know!

jnnks avatar Oct 19 '22 11:10 jnnks

@jnnks No probs! Do you consider the issue closed?

Neved4 avatar Oct 19 '22 11:10 Neved4