termux / science-packages

Science packages for Termux

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

lualatex triggers the fd sanitizer on android 11

Grimler91 opened this issue · comments

Continuation of #50.

Problem description
Trying to compile a tex file with lualatex, or just generating the lualatex format file, fails with something like

fdsan: attempted to close file descriptor 3, expected to be unowned, actually owned by FILE* 0x79ede74418

on android 11 (reported by @panbroggi).

Steps to reproduce
Run lualatex test.tex on some minimal test.tex file, or run luahbtex -ini -jobname=lualatex -progname=lualatex lualatex.ini (which should generate the format file).

Expected behavior
lualatex format file should be generated (if it does not exist) and then the file should be compiled to a pdf.

Additional information

Installing a debug build of texlive-bin and then running

gdb -ex r --args luahbtex -ini -jobname=lualatex -progname=lualatex lualatex.ini

gives this backtrace:

[...]
\font\g__regex_submatch_prev_intarray=cmr10 at 0.00012pt
\font\g__regex_submatch_begin_intarray=cmr10 at 0.00014pt
\font\g__regex_submatch_end_intarray=cmr10 at 0.00015pt
fdsan: attempted to close file descriptor 3, expected to be unowned, actually owned by FILE* 0xb6a1c00c

Program received signal SIGABRT, Aborted.
0xb6a939e8 in fdsan_error(char const*, ...) () from /apex/com.android.runtime/lib/bionic/libc.so
(gdb) bt
#0  0xb6a939e8 in fdsan_error(char const*, ...) () from /apex/com.android.runtime/lib/bionic/libc.so
#1  0xb6a936fe in android_fdsan_close_with_tag () from /apex/com.android.runtime/lib/bionic/libc.so
#2  0xb6a93d6e in close () from /apex/com.android.runtime/lib/bionic/libc.so
#3  0xb655a8f4 in gzclose_w () from /data/data/com.termux/files/usr/lib/libz.so.1.2.11
#4  0x7f627526 in store_fmt_file () at /home/builder/.termux-build/texlive-bin/src/texk/web2c/luatexdir/tex/dumpdata.c:324
#5  0x7f6336bc in main_body () at /home/builder/.termux-build/texlive-bin/src/texk/web2c/luatexdir/tex/mainbody.c:580
#6  0x7f5c9516 in main (ac=<optimized out>, av=<optimized out>) at /home/builder/.termux-build/texlive-bin/src/texk/web2c/luatexdir/luatex.c:609

lualatex's source consists of c-files so should be easier to add the disable fdsan patch compared to for pdflatex