[luaHBtex id 7673 / luatex repository 4ab833a873] [TeXLive 2cd37449119 (from 2025-Apr-02)]
Dear Luigi and friends, I'm using a library called `libtrash`, which intercept calls to `unlink()` and friends, moving files into a trash directory instead of deleting them (this is very handy for command-line use). https://github.com/pete4abw/libtrash This library gets activated by the LD_PRELOAD environment variable; on my platform I have LD_PRELOAD=/usr/local/lib64/libtrash.so in my bash profile. This library does not come with my distribution (openSUSE 15.6); I thus compiled and installed it manually with the distribution's default compiler (gcc version 7.5.0). It work justs fine for almost all applications. Some of them, however, do not, most notably the `chrome` (and `chromium`) browser – and now also `lualatex`. Calling `lualatex simple.tex`, with `simple.tex` being ``` \documentclass{article} \begin{document} Hello world! \end{document} ``` produces a crash. This doesn't happen with either `pdflatex` or with `xelatex`. To get a meaningful backtrace, I've run `./build --debug` from the current luatex repository and copied the resulting binary into the TeXLive tree as `luahbtex`. [I know that I haven't actually built `luahbtex` but this doesn't matter for the problem at hand, AFAICS, and we at least know that it is not the HarfBuzz part that causes a problem :-) ] ``` #0 0x00007ffff7c9bb33 in freopen64 () from /lib64/libc.so.6 #1 0x00007ffff7fbb574 in return_real_function (function=<optimized out>, path=<optimized out>, mode=<optimized out>, mode_str=<optimized out>, flags=<optimized out>, stream=<optimized out>) at open-funs.c:291 #2 0x00007ffff7fbb9a7 in do_fopen_or_freopen_or_open (function=function@entry=6, path=0x63f46f8 "/home/wl/.texlive2025/texmf-var/luatex-cache/generic/fonts/otl/lmroman10-regular.luc") at open-funs.c:569 #3 0x00007ffff7fbbd69 in freopen64 (path=<optimized out>, mode=<optimized out>, stream=<optimized out>) at open-funs.c:135 #4 0x000000000070273d in luaL_loadfilex (L=0x1085768, filename=0x63f46f8 "/home/wl/.texlive2025/texmf-var/luatex-cache/generic/fonts/otl/lmroman10-regular.luc", mode=0x0) at ../../../source/libs/lua53/lua53-src/src/lauxlib.c:721 #5 0x000000000046ad26 in luatex_loadfile (L=0x1085768) at ../../../source/texk/web2c/luatexdir/lua/luastuff.c:239 #6 0x00000000007091c8 in luaD_precall (L=0x1085768, func=0x311c8d0, nresults=1) at ../../../source/libs/lua53/lua53-src/src/ldo.c:434 #7 0x000000000072696e in luaV_execute (L=0x1085768) at ../../../source/libs/lua53/lua53-src/src/lvm.c:1134 #8 0x0000000000709564 in luaD_call (L=0x1085768, func=0x311c540, nResults=1) at ../../../source/libs/lua53/lua53-src/src/ldo.c:499 #9 0x00000000007095c2 in luaD_callnoyield (L=0x1085768, func=0x311c540, nResults=1) at ../../../source/libs/lua53/lua53-src/src/ldo.c:509 #10 0x00000000006ffeab in f_call (L=0x1085768, ud=0x7fffffffd500) at ../../../source/libs/lua53/lua53-src/src/lapi.c:943 #11 0x0000000000708562 in luaD_rawrunprotected (L=0x1085768, f=0x6ffe76 <f_call>, ud=0x7fffffffd500) at ../../../source/libs/lua53/lua53-src/src/ldo.c:142 #12 0x0000000000709d72 in luaD_pcall (L=0x1085768, func=0x6ffe76 <f_call>, u=0x7fffffffd500, old_top=704, ef=0) at ../../../source/libs/lua53/lua53-src/src/ldo.c:729 #13 0x00000000006fff7a in lua_pcallk (L=0x1085768, nargs=3, nresults=1, errfunc=0, ctx=0, k=0x0) at ../../../source/libs/lua53/lua53-src/src/lapi.c:969 #14 0x0000000000491d19 in do_run_callback (special=1, values=0x8b0601 "", vl=0x7fffffffd600) at ../../../source/texk/web2c/luatexdir/lua/lcallbacklib.c:347 #15 0x0000000000491513 in run_and_save_callback (i=35, values=0x8b05fc "Sdd->") at ../../../source/texk/web2c/luatexdir/lua/lcallbacklib.c:249 #16 0x000000000059e590 in do_define_font (f=15, cnom=0x33465b0 "[lmroman10-regular]:+tlig;", s=655360, natural_dir=-1) at ../../../source/texk/web2c/luatexdir/font/dofont.c:55 #17 0x000000000059e838 in read_font_info (u=536442, cnom=0x33465b0 "[lmroman10-regular]:+tlig;", s=655360, natural_dir=-1) at ../../../source/texk/web2c/luatexdir/font/dofont.c:117 #18 0x000000000056552a in tex_def_font (a=4 '\004') at ../../../source/texk/web2c/luatexdir/tex/texdeffont.c:213 #19 0x00000000005273a3 in prefixed_command () at ../../../source/texk/web2c/luatexdir/tex/maincontrol.c:3392 #20 0x000000000051f805 in main_control () at ../../../source/texk/web2c/luatexdir/tex/maincontrol.c:1028 #21 0x000000000051b514 in main_body () at ../../../source/texk/web2c/luatexdir/tex/mainbody.c:590 #22 0x000000000044fc6f in main (ac=2, av=0x7fffffffdab8) at ../../../source/texk/web2c/luatexdir/luatex.c:611 ``` Saying `LD_PRELOAD= lualatex simple.tex` succeeds (unsurprisingly). I have absolutely no idea what exactly causes the problem. Using both manually compiled libtrash and luatex binaries ensures that exactly the same C library gets used. Calling `ldd` gives ``` linux-vdso.so.1 (0x00007ffc7c9f6000) /usr/local/lib64/libtrash.so (0x00007f2f66a21000) libm.so.6 => /lib64/libm.so.6 (0x00007f2f66917000) libc.so.6 => /lib64/libc.so.6 (0x00007f2f66600000) /lib64/ld-linux-x86-64.so.2 (0x00007f2f66a2c000) ``` which also looks OK. I also tried `valgrind lualatex simple.tex`. Before the program itself crashed (which is expected), it reported ``` Invalid read of size 4 ``` and the same function backtrace as above. An interesting observation is that calling `fmtutil-user --all` succeeds! And indeed, using `luatex` on a simple plain TeX file works just fine. This probably points to a bug in the lua code that reads and/or writes the OpenType fonts cache (for example, `lmroman10-regular.luc` as reported in the backtrace). I use libtrash since more than 10 years, and I've never experienced such a problem with luatex. I thus think the problem must have been introduced rather recently (i.e., within the last few weeks) – or maybe I was just lucky, and other changes in TeXLive accidentally started to trigger the crash. Please advise. Werner
