[luatex] \openin with extensionless files.
David Carlisle
d.p.carlisle at gmail.com
Thu Jan 23 16:36:07 CET 2020
Luigi,
Thanks for looking at this.
I built off the github texlive-source repo and ended up with luatex
1.11.2 which is a bit older than you showed although with change log
entry
* Fixed \opein, to be consistent with pdftex in opening
a file without extension (but not enclosed in {})
But it doesn't work for me.
Your test showed
$ cat test.tex
hello
so your file has a .tex extension, could you rename test.tex to test
and check there is no test.tex in the path, and confirm \openin0 test
finds the file test?
Thanks,
David
On Thu, 23 Jan 2020 at 14:02, luigi scarso <luigi.scarso at gmail.com> wrote:
>
>
>
> On Wed, Jan 22, 2020 at 10:10 PM David Carlisle <d.p.carlisle at gmail.com> wrote:
>>
>> With a file with no extension in the same directory (say "test") then
>>
>> \input test
>>
>> and
>>
>> \input{test}
>>
>> both work but
>>
>> \openin test
>>
>> and
>>
>> \openin{test}
>>
>> do not work the same way, it only sees the file if the luatex-specific
>> braced form is used.
>>
>> That means for example the LaTeX \IfFileExists macro reports the file
>> as not existing with luatex and existing with pdftex and xetex.
>>
>> We could (and probably will) have a luatex-specific code branch here
>> to add the braces, but is this difference from pdftex intentional? It
>> has been this way since at least texlive 2017, but still seems strange
>> and not what one would expect from the documentation
>>
>>
>> This causes some problems in end-user documents, for example
>>
>> https://tex.stackexchange.com/questions/511684/inputting-extension-less-files-with-luatex-fails-after-recent-latex-update/511688?noredirect=1#comment1293990_511688
>>
>>
>>
>>
>> This test file:
>>
>> \openin0 test
>>
>> \ifeof0
>> \immediate\write20{NO FILE test}
>> \else
>> \immediate\write20{FILE test}
>> \fi
>>
>> \ifx\directlua\undefined\else
>>
>> \openin2{test}
>>
>> \ifeof2
>> \immediate\write20{NO FILE test}
>> \else
>> \immediate\write20{FILE test}
>> \fi
>>
>> \fi
>>
>> \end
>>
>>
>> Produces the terminal output below
>>
>>
>> $ cat test
>> hello
>>
>> $ luatex noext
>> This is LuaTeX, Version 1.10.0 (TeX Live 2019)
>> restricted system commands enabled.
>> (./noext.tex
>> NO FILE test
>> FILE test
>> )
>>
>> and with pdftex
>>
>> $ pdftex noext
>> This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020)
>> (preloaded format=pdftex)
>> restricted \write18 enabled.
>> entering extended mode
>> (./noext.tex
>> FILE test
>>
>>
>> David
>
>
> We already have patched something in rev. 7213
> so this is what we have now
>
> $ cat test.tex
> hello
>
> $ cat noext.tex
> \openin0 test
>
> \ifeof0
> \immediate\write20{NO FILE test}
> \else
> \immediate\write20{FILE test}
> \fi
>
> \ifx\directlua\undefined\else
>
> \openin2{test}
>
> \ifeof2
> \immediate\write20{NO FILE test}
> \else
> \immediate\write20{FILE test}
> \fi
>
> \fi
>
>
> $ luatex --fmt=luatex-plain noext.tex
> :
> This is LuaTeX, Version 1.12.0 (TeX Live 2020/dev)
> system commands enabled.
> :
> :
> FILE test
> FILE test
> )
> warning (pdf backend): no pages of output.
> Transcript written on noext.log.
>
> --
> luigi
More information about the luatex
mailing list