[Tex/LaTex] error with LuaLaTeX, lstinputlisting and an extension-less file


I'm having troubles with LuaLaTeX and the listings package: the former doesn't seem to accept me performing \lstinputlisting on a filename that doesn't have an extension.

Minimal example:


hello: hello.c
    cc -o hello hello.c



pdfLaTeX is successful, LuaLaTeX displays the following error:

! Package Listings Error: File `Makefile(.tex)' not found.

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

Enter file name:

I'm using the freshest versions from TeXLive 2012 (pdfTeX 3.1415926-2.4-1.40.13, LuaTeX beta-0.70.2-2012052410).

What's the trouble?

Best Answer

The problem has been mentioned on the luatex mailing list: http://tug.org/mailman/htdig/luatex/2013-February/004042.html

The problem is that LaTeX is using \openin and \ifeof to test for the existence of a file and this test fails for files without extensions (despite the fact that the (primitive) \input itself would work).

The problem is not confined to luatex: In miktex your example fails with pdflatex too.

With luatex there is a work around: \openin accepts arguments with braces and this seems to protect the file name. So you can use \lstinputlisting{{Makefile}}.

Related Question