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. Regards, Reinhard -- ------------------------------------------------------------------ Reinhard Kotucha Phone: +49-511-3373112 Marschnerstr. 25 D-30167 Hannover mailto:reinhard.kotucha@web.de ------------------------------------------------------------------
On Tue, Apr 2, 2019 at 12:23 AM Reinhard Kotucha
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.
Regards, Reinhard
-- ------------------------------------------------------------------ Reinhard Kotucha Phone: +49-511-3373112 Marschnerstr. 25 D-30167 Hannover mailto:reinhard.kotucha@web.de ------------------------------------------------------------------ _______________________________________________ dev-luatex mailing list dev-luatex@ntg.nl https://mailman.ntg.nl/mailman/listinfo/dev-luatex
Confirmed. The test is local operatortable = { } operatortable.Do = function(scanner,info) local resources = info.resources if resources then local val = scanner:pop() local name = val[2] local xobject = resources.XObject print(info.space .. "Uses XObject " .. name) local resources = xobject.Resources if resources then local newinfo = { space = info.space .. " ", resources = resources, } pdfscanner.scan(entry, operatortable, newinfo) end end end local function Analyze(filename) local doc = pdfe.open(filename) if doc then local pages = doc.Pages for i=1,#pages do local page = pages[i] local info = { space = " " , resources = page.Resources, } print("Page " .. i) -- pdfscanner.scan(page.Contents,operatortable,info) pdfscanner.scan(page.Contents(),operatortable,info) end end end Analyze("foo.pdf") -- luigi
On Tue, Apr 2, 2019 at 7:18 AM luigi scarso
On Tue, Apr 2, 2019 at 12:23 AM Reinhard Kotucha
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" \directlua{ local operatortable = { } operatortable.Do = function(scanner,info) local resources = info.resources if resources then local val = scanner:pop() local name = val[2] local xobject = resources.XObject print(info.space .. "Uses XObject " .. name) local resources = xobject.Resources if resources then local newinfo = { space = info.space .. " ", resources = resources, } pdfscanner.scan(entry, operatortable, newinfo) end end end local function Analyze(filename) local doc = pdfe.open(filename) if doc then local pages = doc.Pages for i=1,#pages do local page = pages[i] local info = { space = " " , resources = page.Resources, } print("Page " .. i) --[==[ pdfscanner.scan(page.Contents,operatortable,info)]==] pdfscanner.scan(page.Contents(),operatortable,info) end end end Analyze("foo.pdf") } \end -- luigi
On 2019-04-02 at 08:50:23 +0200, luigi scarso wrote:
On Tue, Apr 2, 2019 at 7:18 AM luigi scarso
wrote: On Tue, Apr 2, 2019 at 12:23 AM Reinhard Kotucha < reinhard.kotucha@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.
(./testpdfscanner.tex
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.
Regards,
Reinhard
Core was generated by `./texlua ./testpdfscanner.lua'.
Program terminated with signal 11, Segmentation fault.
#0 0x00000000004c31e8 in tprint (sss=sss@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@entry=0x722ca6 "warning ")
at ../../../texk/web2c/luatexdir/tex/printing.c:419
#1 0x0000000000490d37 in normal_warning (t=t@entry=0x7361e6 "pdfe lib",
p=p@entry=0xc3b5c0
On Tue, Apr 2, 2019 at 9:48 PM Reinhard Kotucha
On 2019-04-02 at 08:50:23 +0200, luigi scarso wrote:
On Tue, Apr 2, 2019 at 7:18 AM luigi scarso
wrote: On Tue, Apr 2, 2019 at 12:23 AM Reinhard Kotucha < reinhard.kotucha@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. (./testpdfscanner.tex 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.
because the print of the warning requires a TeX state. texlua has only a Lua state. -- luigi
On 2019-04-02 at 21:59:21 +0200, luigi scarso wrote:
On Tue, Apr 2, 2019 at 9:48 PM Reinhard Kotucha
wrote: 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. because the print of the warning requires a TeX state. texlua has only a Lua state.
Thanks for the info. I'll use lfs.isfile() then. Regards, Reinhard -- ------------------------------------------------------------------ Reinhard Kotucha Phone: +49-511-3373112 Marschnerstr. 25 D-30167 Hannover mailto:reinhard.kotucha@web.de ------------------------------------------------------------------
Hi Luigi, On 2019-04-02 at 21:59:21 +0200, luigi scarso wrote:
On Tue, Apr 2, 2019 at 9:48 PM Reinhard Kotucha
wrote: 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. because the print of the warning requires a TeX state. texlua has only a Lua state.
Do you have any plan of fixing this? If not, please consider the attached patch. Without this, even the simple file test.lua containing pdfe.open("foo.pdf") causes a segfault... Hironobu
On Mon, Apr 8, 2019 at 1:53 PM Hironobu Yamashita < h.y.acetaminophen@gmail.com> wrote:
Hi Luigi,
On 2019-04-02 at 21:59:21 +0200, luigi scarso wrote:
On Tue, Apr 2, 2019 at 9:48 PM Reinhard Kotucha
wrote: 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.
because the print of the warning requires a TeX state. texlua has only a Lua state.
Do you have any plan of fixing this? If not, please consider the attached patch. Without this, even the simple file test.lua containing
pdfe.open("foo.pdf")
causes a segfault...
Yes I will fix it, unfortunately after TeXLive 2019 is closed. Thank you for the patch. -- luigi
On 2019-04-08 at 20:53:29 +0900, Hironobu Yamashita wrote:
Hi Luigi,
On 2019-04-02 at 21:59:21 +0200, luigi scarso wrote:
On Tue, Apr 2, 2019 at 9:48 PM Reinhard Kotucha
wrote: 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. because the print of the warning requires a TeX state. texlua has only a Lua state.
Do you have any plan of fixing this? If not, please consider the attached patch. Without this, even the simple file test.lua containing
pdfe.open("foo.pdf")
causes a segfault...
Thank you very much! Regards, Reinhard -- ------------------------------------------------------------------ Reinhard Kotucha Phone: +49-511-3373112 Marschnerstr. 25 D-30167 Hannover mailto:reinhard.kotucha@web.de ------------------------------------------------------------------
participants (3)
-
Hironobu Yamashita
-
luigi scarso
-
Reinhard Kotucha