[luatex] Bugs in \input{...}

Phelype Oleinik phe.h.o1 at gmail.com
Mon Jan 27 12:13:16 CET 2020


Hello all,

When using \input{...} inside an \edef the first token
in the file disappears:

    \directlua{\unexpanded{%
      out = io.open('testfile.tex','w')
      out:write('hello\\noexpand')
      io.close(out)}}
    \edef\tmpa{\input{testfile.tex}}\show\tmpa
    % > \tmpa=macro:
    % ello
    \bye

For some reason, it gets worse if the file starts
with \noexpand\something:

    \directlua{\unexpanded{%
      out = io.open('testfile.tex','w')
      out:write('\\noexpand\\hello\\noexpand')
      io.close(out)}}
    \edef\tmpa{\input{testfile.tex}}\show\tmpa
    % > \tmpa=macro:
    % <gibberish>
    \bye

If I use \edef\tmpa{\input testfile.tex } instead, both
examples work as expected.

Also, a smaller issue: \input{...} doesn't seem to be
setting cur_cs when using scan_toks, then the
runaway error message reports it wrong:

    \outer\def\boom{}
    \input{\boom
    \bye

this reports:

    Runaway text?
    ! Forbidden control sequence found while scanning text of \csname\endcsname.
    <inserted text>
    }
    <to be read again>
    \boom
    l.3 \input{\boom

    ?

Phelype


More information about the luatex mailing list.