[luatex] Bug in io.popen

Deepak Jois deepak.jois at gmail.com
Fri Oct 21 16:40:59 CEST 2016


See below for a minimal example of how io.popen behavior seems to be
different in LuaTeX, which leads to an error. It seems that the 'read'
method is not present on whatever is returned from io.popen.

I ran across this issue when trying to use LuaRocks within LuaTeX.
LuaRocks runs something like:

===
local version = io.popen("sw_vers -productVersion"):read("*l")
===

which errors out.

This happens even when I disable kpse and set texconfig.shell_escape to 't'.

Is this a bug?

======
Regular Lua interpreter:
$ lua
Lua 5.2.4  Copyright (C) 1994-2015 Lua.org, PUC-Rio
> io.popen("ls"):read("*l")

Luatex:

$ cat popen.tex
\directlua{io.popen("ls"):read("*l")}

$ luatex popen.tex
This is LuaTeX, Version 0.95.0 (TeX Live 2016)
 restricted system commands enabled.
(./popen.tex[\directlua]:1: attempt to index a nil value
stack traceback:
        [\directlua]:1: in main chunk.
l.1 \directlua{io.popen("ls"):read("*l")}

? ^D
! Emergency stop.
l.1 \directlua{io.popen("ls"):read("*l")}

!  ==> Fatal error occurred, no output PDF file produced!
Transcript written on popen.log.
===


More information about the luatex mailing list