[Dev-luatex] segfault on example in manual

Reinhard Kotucha reinhard.kotucha at web.de
Tue Apr 2 21:48:51 CEST 2019

On 2019-04-02 at 08:50:23 +0200, luigi scarso wrote:

 > On Tue, Apr 2, 2019 at 7:18 AM luigi scarso <luigi.scarso at gmail.com> wrote:
 >     On Tue, Apr 2, 2019 at 12:23 AM Reinhard Kotucha <
 >     reinhard.kotucha at web.de> wrote:
 >         Hi,
 >         when I run the example on page 261/262 of the LuaTeX Manual and the
 >         input file ("foo.pdf" in the example) doesn't exist, I get
 >           Segmentation fault (core dumped)
 >         on x86_64-linux.
 > This is ok
 > $ luatex --fmt=luatex-plain  "test-plain.tex"

Hi Luigi,
this works here too.  I get:

  This is LuaTeX, Version 1.10.0 (TeX Live 2019) 
  restricted system commands enabled.
  warning  (pdfe lib): no valid pdf file 'foo.pdf'
  (see the transcript file for additional information)
  warning  (pdf backend): no pages of output.
  Transcript written on testpdfscanner.log.

I suppose that texlua crashes when trying to print the warning, see
gdb output below.  What I don't understand is is why luatex and
texlua behave differently here.


Core was generated by `./texlua ./testpdfscanner.lua'.
Program terminated with signal 11, Segmentation fault.
#0  0x00000000004c31e8 in tprint (sss=sss at entry=0x722ca6 "warning ")
    at ../../../texk/web2c/luatexdir/tex/printing.c:419
419	    int newlinechar = new_line_char_par;
(gdb) bt
#0  0x00000000004c31e8 in tprint (sss=sss at entry=0x722ca6 "warning ")
    at ../../../texk/web2c/luatexdir/tex/printing.c:419
#1  0x0000000000490d37 in normal_warning (t=t at entry=0x7361e6 "pdfe lib", 
    p=p at entry=0xc3b5c0 <print_buf> "no valid pdf file 'foo.pdf'")
    at ../../../texk/web2c/luatexdir/tex/errors.c:992
#2  0x0000000000490f15 in formatted_warning (t=t at entry=0x7361e6 "pdfe lib", 
    fmt=fmt at entry=0x7361ef "no valid pdf file '%s'")
    at ../../../texk/web2c/luatexdir/tex/errors.c:1031
#3  0x0000000000525904 in pdfelib_open (L=0x1d97048)
    at ../../../texk/web2c/luatexdir/lua/lpdfelib.c:836
#4  0x0000000000642911 in luaD_precall (L=L at entry=0x1d97048, 
    func=func at entry=0x1e61b10, nresults=nresults at entry=1)
    at ../../../libs/lua53/lua53-src/src/ldo.c:434
#5  0x000000000065586d in luaV_execute (L=L at entry=0x1d97048)
    at ../../../libs/lua53/lua53-src/src/lvm.c:1134
#6  0x0000000000642bdf in luaD_call (L=L at entry=0x1d97048, 
    func=<optimized out>, nResults=<optimized out>)
    at ../../../libs/lua53/lua53-src/src/ldo.c:499
#7  0x0000000000642c31 in luaD_callnoyield (L=0x1d97048, func=<optimized out>, 
    nResults=<optimized out>) at ../../../libs/lua53/lua53-src/src/ldo.c:509
#8  0x000000000064207c in luaD_rawrunprotected (L=L at entry=0x1d97048, 
    f=f at entry=0x63a690 <f_call>, ud=ud at entry=0x7ffcb9c7fbc0)
    at ../../../libs/lua53/lua53-src/src/ldo.c:142
#9  0x0000000000642efd in luaD_pcall (L=L at entry=0x1d97048, 
    func=func at entry=0x63a690 <f_call>, u=u at entry=0x7ffcb9c7fbc0, old_top=720, 
    ef=<optimized out>) at ../../../libs/lua53/lua53-src/src/ldo.c:729
#10 0x000000000063bb2c in lua_pcallk (L=0x1d97048, nargs=nargs at entry=0, 
    nresults=nresults at entry=0, errfunc=errfunc at entry=0, ctx=ctx at entry=0, 
    k=k at entry=0x0) at ../../../libs/lua53/lua53-src/src/lapi.c:969
#11 0x000000000047bb29 in lua_initialize (ac=<optimized out>, 
    av=<optimized out>) at ../../../texk/web2c/luatexdir/lua/luainit.c:1046
#12 0x0000000000445a09 in main (ac=<optimized out>, av=<optimized out>)
    at ../../../texk/web2c/luatexdir/luatex.c:588
(gdb) quit

Reinhard Kotucha                            Phone: +49-511-3373112
Marschnerstr. 25
D-30167 Hannover                    mailto:reinhard.kotucha at web.de

More information about the dev-luatex mailing list