Skip to content
This repository has been archived by the owner on Dec 4, 2021. It is now read-only.

pdflatex not working on Android 11 beta 3 #50

Closed
StrangeGranddad opened this issue Aug 17, 2020 · 34 comments
Closed

pdflatex not working on Android 11 beta 3 #50

StrangeGranddad opened this issue Aug 17, 2020 · 34 comments
Labels
bug Something isn't working

Comments

@StrangeGranddad
Copy link

Problem description

Hello,

this is a fresh install of termux on a Pixel 4 with the current Android 11 beta 3 / release candidate.

After installing texlive-full I tried running pdflatex on a document created on the same phone before doing the update to beta 3 (from Android 10).

The result ends in

fdsan: attempted to close file descriptor 3, expected to be unowned, actually owned by FILE* 0x773f6a14b8
mktexfmt [INFO]: log file copied to: /data/data/com.termux/files/home/.texlive2020/texmf-var/web2c/pdftex/pdflatex.log
mktexfmt [ERROR]: running `pdftex -ini   -jobname=pdflatex -progname=pdflatex -translate-file=cp227.tcx *pdflatex.ini >&2 </dev/null' return status: 0.0234375
mktexfmt [ERROR]: returning error due to option --strict
mktexfmt [INFO]: disabled formats: 19
mktexfmt [INFO]: not selected formats: 40
mktexfmt [INFO]: failed to build: 1 (pdftex/pdflatex)
mktexfmt [INFO]: total formats: 60
mktexfmt [INFO]: exiting with status 1
I can't find the format file `pdflatex.fmt'!

Steps to reproduce

  • install Android 11 b3
  • install termux from playstore
  • install texlive-full
  • run pdflatex on minimal .tex-file

Expected behavior
I expected to run pdflatex on a syntactically correct .tex-file without error, resulting in a .pdf-file.

Additional information

[u0_a359@localhost]-[~] termux-info
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://dl.bintray.com/termux/termux-packages-24/ stable main
# game-repo (sources.list.d/game.list)
deb https://dl.bintray.com/grimler/game-packages-24 games stable
# science-repo (sources.list.d/science.list)
deb https://dl.bintray.com/grimler/science-packages-24 science stable
Updatable packages:
All packages up to date
Android version:
11
Kernel build information:
Linux localhost 4.14.180-g051355490483-ab6669324 #1 SMP PREEMPT Fri Jul 10 09:40                                                                                        :47 UTC 2020 aarch64 Android
Device manufacturer:
Google
Device model:
Pixel 4 XL

Please find the content of /data/data/com.termux/files/home/.texlive2020/texmf-var/web2c/pdftex/pdflatex.log attached as advised in https://www.reddit.com/r/termux/comments/ib8j7z/pdflatex_not_working_on/

pdflatex.log

@Grimler91 Grimler91 added the bug Something isn't working label Aug 17, 2020
@Grimler91
Copy link
Member

Thanks! According to https://developer.android.com/preview/behavior-changes-all#fdsan the fdsan behaviour changed in android 11 to give an error instead of just a warning. The pdflatex.log unfortunately does not contain the fdsan error, could you paste the last ~5 lines before the fdsan: attempted to close file descriptor 3, expected to be unowned, actually owned by FILE* 0x773f6a14b8 error, to help pinpoint where it happens?

I'll look into booting up android 11 in an emulator..

@StrangeGranddad
Copy link
Author

Please see the attached script file of the pdflatex run.

log.txt

@StrangeGranddad
Copy link
Author

Btw: The behaviour is still repoducible on the released Android 11.

@Grimler91
Copy link
Member

@StrangeGranddad could you try capturing a logcat when running the dumping command: pdftex -ini -jobname=pdflatex -progname=pdflatex -translate-file=cp227.tcx *pdflatex.ini, and see if that outputs a backtrace (similar to in my comment here)?

@StrangeGranddad
Copy link
Author

Yes, of course. Find the logcat attached, hth.

logcat.txt

@Kreijstal
Copy link

Kreijstal commented Feb 16, 2021

Oh, I just had this bug I thought I was the only one I was becoming nuts

Error log
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020/Termux) (preloaded format=latex)
 restricted \write18 enabled.

kpathsea: Running mktexfmt latex.fmt
mktexfmt: mktexfmt is using the following fmtutil.cnf files (in precedence order):
mktexfmt:   /data/data/com.termux/files/usr/share/texlive/texmf-dist/web2c/fmtutil.cnf
mktexfmt: mktexfmt is using the following fmtutil.cnf file for writing changes:
mktexfmt:   /data/data/com.termux/files/home/.texlive2020/texmf-config/web2c/fmtutil.cnf
mktexfmt [INFO]: writing formats under /data/data/com.termux/files/home/.texlive2020/texmf-var/web2c
mktexfmt [INFO]: --- remaking latex with pdftex
mktexfmt: running `pdftex -ini   -jobname=latex -progname=latex -translate-file=cp227.tcx *latex.ini' ...
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020/Termux) (INITEX)
 restricted \write18 enabled.
 (/data/data/com.termux/files/usr/share/texlive/texmf-dist/web2c/cp227.tcx)
entering extended mode

(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/latex/latexconfig
/latex.ini
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/tex-ini-f
iles/pdftexconfig.tex)

(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/latex/base/latex.
ltx
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/latex/base/texsys
.cfg)
./texsys.aux found


\@currdir set to: ./.


Assuming \openin and \input 
have the same search path.


Defining UNIX/DOS style filename parser.

catcodes, registers, parameters,
LaTeX2e <2020-02-02> patch level 5
hacks, control, par, spacing, files, font encodings, lengths,
====================================

Local config file fonttext.cfg used

====================================

(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/latex/base/fontte
xt.cfg
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/latex/base/fontte
xt.ltx
=== Don't modify this file, use a .cfg file instead ===


(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/latex/base/omlenc
.def)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/latex/base/omsenc
.def)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/latex/base/ot1enc
.def)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/latex/base/t1enc.
def)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/latex/base/ts1enc
.def)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/latex/base/ts1cmr
.fd)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/latex/base/t1cmr.
fd)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/latex/base/ot1cmr
.fd)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/latex/base/ot1cms
s.fd)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/latex/base/ot1cmt
t.fd)))
====================================

Local config file fontmath.cfg used

====================================

(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/latex/base/fontma
th.cfg
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/latex/base/fontma
th.ltx
=== Don't modify this file, use a .cfg file instead ===


(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/latex/base/omlcmm
.fd)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/latex/base/omscms
y.fd)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/latex/base/omxcme
x.fd)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/latex/base/ucmr.f
d)))
====================================

Local config file preload.cfg used

=====================================

(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/latex/base/preloa
d.cfg
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/latex/base/preloa
d.ltx)) page nos., x-ref, environments, center, verbatim, math definitions,
boxes, title, sectioning, contents, floats, footnotes, index, bibliography,
output,
===========================================
Local configuration file hyphen.cfg used
===========================================

(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/babel/hyp
hen.cfg
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/babel/swi
tch.def)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyphen/hy
phen.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyphen/du
myhyph.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyphen/ze
rohyph.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/dehyph-ex
ptl/dehypht-x-2019-04-04.tex dehyph-exptl: using an 8-bit TeX engine.
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/dehyph-ex
ptl/dehypht-x-2019-04-04.pat
German Hyphenation Patterns (Traditional Orthography) `dehypht-x' 2019-04-04 (W
L)))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/dehyph-ex
ptl/dehyphn-x-2019-04-04.tex dehyph-exptl: using an 8-bit TeX engine.
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/dehyph-ex
ptl/dehyphn-x-2019-04-04.pat
German Hyphenation Patterns (Reformed Orthography, 2006) `dehyphn-x' 2019-04-04
 (WL)))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-af.tex EC Afrikaans hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/conversions/conv-utf8-ec.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-af.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-grc.tex Hyphenation patterns for Ancient Greek
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyphen/gr
ahyph5.tex Hyphenation patterns for Ancient Greek))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyphen/ib
yhyph.tex Greek hyphenation patterns for Ibycus encoding, v3.0)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyphen/ze
rohyph.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-hy.tex
No Armenian hyphenation patterns - only for Unicode engines)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-eu.tex EC Basque hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/conversions/conv-utf8-ec.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-eu.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-be.tex T2A Belarusian hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/conversions/conv-utf8-t2a.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-be.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-bg.tex T2A Bulgarian hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/conversions/conv-utf8-t2a.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-bg.tex
Bulgarian hyphenation patterns (options: --safe-morphology --standalone-tex, ve
rsion 21 October 2017)))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-ca.tex EC Catalan hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/conversions/conv-utf8-ec.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-ca.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-zh-latn-pinyin.tex
EC Pinyin Hyphenation Patterns (with tone markers) 2018-11-25 (WL)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/ptex/hyph-zh-latn-pinyin.ec.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-cu.tex
No Church Slavonic hyphenation patterns - only for Unicode engines)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-cop.tex Coptic hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex-8bit/copthyph.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-hr.tex EC Croatian hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/conversions/conv-utf8-ec.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-hr.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-cs.tex EC Czech hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/conversions/conv-utf8-ec.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-cs.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-da.tex EC Danish hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/conversions/conv-utf8-ec.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-da.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-nl.tex EC Dutch hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/conversions/conv-utf8-ec.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-nl.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-en-gb.tex ASCII Hyphenation patterns for British English
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-en-gb.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-en-us.tex ASCII Hyphenation patterns for American English
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-en-us.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-eo.tex IL3 Esperanto hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/conversions/conv-utf8-il3.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-eo.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-et.tex EC Estonian hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/conversions/conv-utf8-ec.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-et.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-mul-ethi.tex
No Pan-Ethiopic hyphenation patterns - only for Unicode engines)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyphen/ze
rohyph.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-fi.tex EC Finnish hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/conversions/conv-utf8-ec.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-fi.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-fr.tex EC French hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/conversions/conv-utf8-ec.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-fr.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-fur.tex EC Friulan hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/conversions/conv-utf8-ec.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-fur.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-gl.tex EC Galician hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/conversions/conv-utf8-ec.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-gl.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-ka.tex T8M Georgian hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/conversions/conv-utf8-t8m.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-ka.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-de-1901.tex
EC German hyphenation patterns (traditional orthography)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/dehyph/de
hypht.tex
German Traditional Hyphenation Patterns `dehypht' Version 3.2a <1999/03/03>
(Formerly known under the name `ghyph31' and `ghyphen'.)))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-de-1996.tex
EC German hyphenation patterns (reformed orthography)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/dehyph/de
hyphn.tex New German Hyphenation Patterns `dehyphn' Rev.31 <2001-05-07> (WaS)))

(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-de-ch-1901.tex
EC Swiss-German hyphenation patterns (traditional orthography)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/conversions/conv-utf8-ec.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-de-ch-1901.tex
Swiss-German Hyphenation Patterns (Traditional Orthography) `dehyphts-x' 2019-0
4-04 (WL)))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-el-monoton.tex
Hyphenation patterns for uni-accent (monotonic) Modern Greek
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyphen/gr
mhyph5.tex Hyphenation patterns for uni-accent (monotonic) Modern Greek))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-el-polyton.tex
Hyphenation patterns for multi-accent (polytonic) Modern Greek
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyphen/gr
phyph5.tex Hyphenation patterns for multi-accent (polytonic) Modern Greek))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-hu.tex EC Hungarian hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/conversions/conv-utf8-ec.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-hu.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-is.tex EC Icelandic hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/conversions/conv-utf8-ec.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-is.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-as.tex
No Assamese hyphenation patterns - only for Unicode engines)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-bn.tex
No Bengali hyphenation patterns - only for Unicode engines)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-gu.tex
No Gujarati hyphenation patterns - only for Unicode engines)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-hi.tex
No Hindi hyphenation patterns - only for Unicode engines)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-kn.tex
No Kannada hyphenation patterns - only for Unicode engines)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-ml.tex
No Malayalam hyphenation patterns - only for Unicode engines)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-mr.tex
No Marathi hyphenation patterns - only for Unicode engines)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-or.tex
No Oriya hyphenation patterns - only for Unicode engines)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-pa.tex
No Panjabi hyphenation patterns - only for Unicode engines)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-pi.tex
No Pali hyphenation patterns - only for Unicode engines)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-ta.tex
No Tamil hyphenation patterns - only for Unicode engines)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-te.tex
No Telugu hyphenation patterns - only for Unicode engines)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-id.tex ASCII Indonesian hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-id.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-ia.tex ASCII Hyphenation patterns for Interlingua
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-ia.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-ga.tex EC Irish hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/conversions/conv-utf8-ec.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-ga.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-it.tex ASCII Italian hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-it.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-kmr.tex EC Kurmanji hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/conversions/conv-utf8-ec.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-kmr.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-la.tex EC Latin hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/conversions/conv-utf8-ec.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-la.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-la-x-classic.tex
EC Classical Latin hyphenation patterns, v.2.0 2019-07-03
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex-8bit/hyph-la-x-classic.ec.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-la-x-liturgic.tex EC Liturgical Latin hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/ptex/hyph-la-x-liturgic.ec.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-lv.tex L7X Latvian hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/conversions/conv-utf8-l7x.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-lv.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-lt.tex L7X Lithuanian hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/conversions/conv-utf8-l7x.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-lt.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-mk.tex
No Macedonian hyphenation patterns - only for Unicode engines)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-mn-cyrl.tex T2A (New) Mongolian hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/conversions/conv-utf8-t2a.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-mn-cyrl.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-mn-cyrl-x-lmc.tex LMC Mongolian hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/conversions/conv-utf8-lmc.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-mn-cyrl-x-lmc.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-nb.tex EC Norwegian Bokmal hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/conversions/conv-utf8-ec.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-nb.tex
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-no.tex)))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-nn.tex EC Norwegian Nynorsk hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/conversions/conv-utf8-ec.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-nn.tex
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-no.tex)))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-oc.tex EC Occitan hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/conversions/conv-utf8-ec.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-oc.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-pms.tex ASCII Piedmontese hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-pms.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-pl.tex QX Polish hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/conversions/conv-utf8-qx.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-pl.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-pt.tex EC Portuguese hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/conversions/conv-utf8-ec.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-pt.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-ro.tex EC Romanian hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/conversions/conv-utf8-ec.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-ro.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-rm.tex ASCII Romansh hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-rm.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-ru.tex T2A Russian hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/ruhyphen/
ruhyphen.tex
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/ruhyphen/
catkoi.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/ruhyphen/
koi2t2a.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/ruhyphen/
ruhyphal.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/ruhyphen/
cyryoal.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/ruhyphen/
hypht2.tex)))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-sa.tex
No Sanskrit hyphenation patterns - only for Unicode engines)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-sr-latn.tex EC Serbian hyphenation patterns in Latin script
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/conversions/conv-utf8-ec.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-sh-latn.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-sr-cyrl.tex
T2A Serbian hyphenation patterns in Cyrillic script
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/conversions/conv-utf8-t2a.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-sh-cyrl.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-sk.tex EC Slovak hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/conversions/conv-utf8-ec.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-sk.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-sl.tex EC Slovenian hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/conversions/conv-utf8-ec.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-sl.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-es.tex EC Spanish hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/conversions/conv-utf8-ec.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-es.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-sv.tex EC Swedish hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/conversions/conv-utf8-ec.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-sv.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-th.tex LTH Thai hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/conversions/conv-utf8-lth.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-th.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-tr.tex EC Turkish hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/conversions/conv-utf8-ec.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-tr.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-tk.tex EC Turkmen hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/conversions/conv-utf8-ec.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-tk.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-uk.tex T2A Ukrainian hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/ukrhyph/u
krhyph.tex Ukrainian hyphenation patterns in t2a encoding
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/ukrhyph/c
atlcy.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/ukrhyph/l
cy2t2a.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/ukrhyph/u
krhypmp.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/ruhyphen/
hypht2.tex)))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-hsb.tex EC Upper Sorbian hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/conversions/conv-utf8-ec.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-hsb.tex))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/loadhyph/loadhyph-cy.tex EC Welsh hyphenation patterns
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/conversions/conv-utf8-ec.tex)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/generic/hyph-utf8
/patterns/tex/hyph-cy.tex)))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/latex/base/utf8.d
ef
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/latex/base/omsenc
.dfu)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/latex/base/ot1enc
.dfu)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/latex/base/t1enc.
dfu)
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/latex/base/ts1enc
.dfu))
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/latex/base/ltexpl
.ltx
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/latex/l3kernel/ex
pl3.ltx
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/latex/l3kernel/ex
pl3-code.tex
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/latex/l3kernel/l3
deprecation.def))))fdsan: attempted to close file descriptor 3, expected to be unowned, actually owned by FILE* 0x773ddb0888
mktexfmt [INFO]: log file copied to: /data/data/com.termux/files/home/.texlive2020/texmf-var/web2c/pdftex/latex.log
mktexfmt [ERROR]: running `pdftex -ini   -jobname=latex -progname=latex -translate-file=cp227.tcx *latex.ini >&2 </dev/null' return status: 0.0234375
mktexfmt [ERROR]: returning error due to option --strict
mktexfmt [INFO]: disabled formats: 19
mktexfmt [INFO]: not selected formats: 40
mktexfmt [INFO]: failed to build: 1 (pdftex/latex)
mktexfmt [INFO]: total formats: 60
mktexfmt [INFO]: exiting with status 1
I can't find the format file `latex.fmt'!
Neither pdflatex nor latex works

@Grimler91
Copy link
Member

Grimler91 commented Mar 30, 2021

With a debug build of texlive-bin we get this backtrace from gdb when running pdftex --ini -jobname=pdflatex -translate-file=cp227.tcx *pdflatex.ini:

0 words of pdfTeX memory
fdsan: attempted to close file descriptor 3, expected to be unowned, actually owned by FILE* 0xb6c6100c

Program received signal SIGABRT, Aborted.
0xb64ec9e8 in fdsan_error(char const*, ...) () from /apex/com.android.runtime/lib/bionic/libc.so
(gdb) bt
#0  0xb64ec9e8 in fdsan_error(char const*, ...) () from /apex/com.android.runtime/lib/bionic/libc.so
#1  0xb64ec6fe in android_fdsan_close_with_tag () from /apex/com.android.runtime/lib/bionic/libc.so
#2  0xb64ecd6e in close () from /apex/com.android.runtime/lib/bionic/libc.so
#3  0xb68b18f4 in gzclose_w () from /data/data/com.termux/files/usr/lib/libz.so.1.2.11
#4  0x7f56abd8 in storefmtfile () at pdftexini.c:3584
#5  0x7f570806 in mainbody () at pdftexini.c:5651
#6  0x7f5609c0 in main (ac=<optimized out>, av=<optimized out>)
    at /home/builder/.termux-build/texlive-bin/src/texk/web2c/lib/texmfmp.c:1098

Fixing it requires deep diving into the code, seems fairly hard to detect where and why it happens.

I'll send an email to the texlive mailing list and ask for help.

@Grimler91
Copy link
Member

Grimler91 commented Apr 3, 2021

Here's a minimal program, condensed from texlive source, that reproduces the problem

#include <zlib.h>
#include <stdio.h>
int open_output(FILE **f_ptr, char *mode) {
  *f_ptr = fopen ("test.gz", mode);
  return *f_ptr != NULL;
}
#define wopenout(f) (open_output ((FILE**)&(f), "wb") \
                     && (f = gzdopen(fileno((FILE*)f), "wb")))
int main() {
  gzFile fp;
  wopenout(fp);
  gzclose(fp);
}

Compiling with clang-11 as in clang -lz -o test test.c gives no warnings or errors. When running ./test we get the fdsan error.

Changing from a macro implementation of wopenout to a normal function fixes the problem. Feels like this might be a bionic bug.

Working program:

#include <zlib.h>
#include <stdio.h>
int open_output(FILE **f_ptr, char *mode) {
  *f_ptr = fopen ("test.gz", mode);
  return *f_ptr != NULL;
}
void wopenout (gzFile f) {
  open_output ((FILE**)&(f), "wb");
  f = gzdopen(fileno((FILE*)f), "wb");
}
int main() {
  gzFile fp;
  wopenout(fp);
  gzclose(fp);
}
Edit: see two comments down

@Grimler91
Copy link
Member

I opened an issue in google's issue tracker: https://issuetracker.google.com/issues/184380442

Let's hope it gets some attention.

@StrangeGranddad are you using stock android?
Could you try to compile and run the two programs above to see so that you get a crash (or not) as I did?

@Grimler91
Copy link
Member

I forgot to check return value of open_output. If I add that:

void wopenout (gzFile f) {
  if (open_output ((FILE**)&(f), "wb"))
    f = gzdopen(fileno((FILE*)f), "wb");
}

I get the fdsan error for the function implementation as well, so I suppose there is a real fdsan issue here.

@Grimler91
Copy link
Member

Grimler91 commented Apr 3, 2021

With the if guard added it looks like the issue is that the code is gzclose'ing even if gzopen was not run:

#include <zlib.h>
#include <stdio.h>
int open_output(FILE **f_ptr, char *mode) {
  *f_ptr = fopen ("test.gz", mode);
  return *f_ptr != NULL;
}
void wopenout (gzFile f) {
  if (open_output ((FILE**)&(f), "wb")) {
    /* this is not run if open_output failed */
    f = gzdopen(fileno((FILE*)f), "wb");
  }
}
int main() {
  gzFile fp;
  wopenout(fp);
  /* this is always run */
  gzclose(fp);
}

@Grimler91
Copy link
Member

It also has to do with optimization level. With -O0 it works with some compilers (like clang on device, but not cross-compiling with android-ndk clang), but -O1 or higher crashes.

Changing the code so that gzclose is only run if fp is not NULL seem to work for this small example, but not in the actual texlive code unfortunately. If I do that in texlive I get a slightly different backtrace:

#0  0xb630f9e8 in fdsan_error(char const*, ...) () from /apex/com.android.runtime/lib/bionic/libc.so
#1  0xb630f6fe in android_fdsan_close_with_tag () from /apex/com.android.runtime/lib/bionic/libc.so
#2  0xb630fd6e in close () from /apex/com.android.runtime/lib/bionic/libc.so
#3  0xb6163afc in gzclose_w (file=0xb6c86320) at /home/builder/.termux-build/zlib/src/gzwrite.c:661
#4  0xb61614f6 in gzclose (file=0xb6c86320) at /home/builder/.termux-build/zlib/src/gzclose.c:21
#5  0x7f56ad40 in storefmtfile () at pdftexini.c:3587
#6  0x7f570984 in mainbody () at pdftexini.c:5658
#7  0x7f560a40 in main (ac=<optimized out>, av=<optimized out>) at /home/builder/.termux-build/texlive-bin/src/texk/web2c/lib/texmfmp.c:1112

@Grimler91
Copy link
Member

Comparing the assembly of the -O0 and -O1 programs show that open_output and main has been optimized.


Compiling with -Wall also showed a warning

test.c:13:12: warning: variable 'fp' is uninitialized when used here [-Wuninitialized]
  wopenout(fp);
           ^~
test.c:12:12: note: initialize the variable 'fp' to silence this warning
  gzFile fp;
           ^
            = NULL
1 warning generated.

After initializing gzFile to null as suggested the error is gone again for the function-implementation of wopenout, but not for the macro-implementation of wopenout.

When replacing the wopenout macro with a wopenout function in texlive pdftex cannot open the fmtfile:

[...]
(/data/data/com.termux/files/usr/share/texlive/texmf-dist/tex/latex/firstaid/la
tex2e-first-aid-for-external-files.ltx)
 ) )
Beginning to dump on file pdflatex.fmt
! Could not write 1 4-byte item(s) to pdflatex.fmt.
 (preloaded format=pdflatex 2021.4.4)

which probably means that I have made an error in the patch:

--- ./texk/web2c/texmfmp.h.orig	2021-04-04 09:21:49.681023734 +0000
+++ ./texk/web2c/texmfmp.h	2021-04-04 09:27:51.274404368 +0000
@@ -266,14 +266,20 @@
 #define bopenout(f)	open_output (&(f), FOPEN_WBIN_MODE)
 #define bclose		aclose
 #ifdef FMT_COMPRESS
+#include <zlib.h>
 /* f is declared as gzFile, but we temporarily use it for a FILE *
    so that we can use the standard open calls */
 #define wopenin(f)	(open_input ((FILE**)&(f), DUMP_FORMAT, FOPEN_RBIN_MODE) \
 						&& (f = gzdopen(fileno((FILE*)f), FOPEN_RBIN_MODE)))
-#define wopenout(f)	(open_output ((FILE**)&(f), FOPEN_WBIN_MODE) \
-						&& (f = gzdopen(fileno((FILE*)f), FOPEN_WBIN_MODE)) \
-						&& (gzsetparams(f, 1, Z_DEFAULT_STRATEGY) == Z_OK))
+static inline int wopenout(gzFile f) {
+  if (open_output ((FILE**)&(f), FOPEN_WBIN_MODE)) {
+    f = gzdopen(fileno((FILE*)f), FOPEN_WBIN_MODE);
+    if (f)
+      return gzsetparams(f, 1, Z_DEFAULT_STRATEGY) == Z_OK;
+  }
+  return 1;
+}
 #define wclose(f)	gzclose(f)
 #else
 #define wopenin(f)	open_input (&(f), DUMP_FORMAT, FOPEN_RBIN_MODE)
 #define wopenout	bopenout

maybe there's some other error in wopenout.. Haven't gotten any response on the mailing list yet.

@panbroggi
Copy link

panbroggi commented Apr 13, 2021

Hi! Not surprisingly, I confirm the issue on Galaxy Tab s6.

I have noticed that in the macro wopenout(f) the second condition is

(f = gzdopen(fileno((FILE*)f), FOPEN_WBIN_MODE))

which, I guess, means that the assignment was successful. In the function, f itself is used as a boolean. Maybe this is the reason why you get the error.

@Grimler91
Copy link
Member

@panbroggi thanks for testing. Using f as a boolean should be fine, it basically means if f != NULL; then.
However, I did get some help on the mailing list, Marcel wrote:

The issue is that the macro assigns the opened file handle to the variable passed as parameter. In a macro this does the expected thing, but in a function this just changes the local copy of the parameter leaving the original variable unchanged.

Which makes sense, a macro is expanded so f as used in main() in my example will be changed after using wopenout as a macro. For the wopenout function however f in main() is not modified when we run f = gzdopen(fileno((FILE*)f), "wb"); in the function.

Proper "fix" (in the sense that fdsan would be happy) here would be re-writing the code so that the file is opened without the gzFile -> FILE casting, so that we keep track of one fd and, I suppose, another gzFile parameter. Have not had time to dig into it unfortunately.

Also, as an alternative fix/workaround have a patch by @xeffyr for disabling fdsan, but I have not found a suitable place to insert it in texlive.

@panbroggi
Copy link

panbroggi commented Apr 21, 2021

I see. However, according to gzdopen, it may be clearer to set it to f != Z_NULL.

It might be a naive approach, but would a combined macro + function solution work? I mean, by passing the pointer one should effectively modify f

#define wopenout(f)   wopenout_func(&f)

static inline int wopenout_func(gzFile* f_ptr) {
  if (open_output ((FILE**)&(f[0]), FOPEN_WBIN_MODE)) {
    f[0] = gzdopen(fileno((FILE*)f[0]), FOPEN_WBIN_MODE);
    if (f[0] != Z_NULL)
      return gzsetparams(f[0], 1, Z_DEFAULT_STRATEGY) == Z_OK;
 }
 return 1;
}

Also, thanks a lot for working on this. I am not able to test and run these modifications by myself, I'm sorry. What should I do in order to do these tests?

@Grimler91
Copy link
Member

Sorry for dropping the ball here

What should I do in order to do these tests?

To test you either need to compile texlive with the modifications on device, or cross-compile from the docker image.

In any case, it will probably be easier to add a patch like the one for emacs, just need to find where to add it

@angelog0
Copy link

In short, we cannot use TeXLive on android 11. One of the worst operating systems ever born!

@Kreijstal
Copy link

In short, we cannot use TeXLive on android 11. One of the worst operating systems ever born!

I mean, it's just propietary so issues may happen

@angelog0
Copy link

@Kreijstal wrote:

I mean, it's just propietary so issues may happen

No, all the more reason there should be no bugs! ..and this is not properly e bug but a wrong design..

@angelog0
Copy link

@Grimler91 wrote:

In any case, it will probably be easier to add a patch like the one for emacs, just need to find where to add it

Any chance of seeing this problem fixed?

@ghost
Copy link

ghost commented Jun 21, 2021

In any case, it will probably be easier to add a patch like the one for emacs, just need to find where to add it

Add

#ifdef __ANDROID__
  // For Android 11+.
  void *lib_handle = dlopen("libc.so", RTLD_LAZY);
  if (lib_handle) {
    void (*set_fdsan_error_level)(enum android_fdsan_error_level newlevel) = dlsym(lib_handle, "android_fdsan_set_error_level");
    if (set_fdsan_error_level) {
      set_fdsan_error_level(ANDROID_FDSAN_ERROR_LEVEL_DISABLED);
    }
    dlclose(lib_handle);
  }
#endif

into main() function of program triggering fd sanitizer. Relevant includes should also be added.

@Grimler91
Copy link
Member

Please try texlive-bin 20210325 when the build for termux/termux-packages@d1199c0 finishes. pdflatex works for me after the added patch, both when generating the format file and when compiling a .tex file.

@panbroggi
Copy link

That's wonderful. I tested pdflatex, xelatex and lualatex with the simple document

\documentclass{article}
\begin{document}
This is a test of the article
\end{document}

Both pdflatex and zelatex work, while lualatex gives something similar to the old error

"I can't find the format file `lualatex.fmt'!"

@Grimler91
Copy link
Member

@panbroggi thanks for testing! What is the full output you get?

Could just mean that the lualatex.fmt failed to generate for an unrelated reason, or that it needs a similar patch

@angelog0
Copy link

angelog0 commented Jun 25, 2021

@Grimler91,

Please try texlive-bin 20210325

It seems there are still issues

pkg upgrade
[...]
The following packages will be upgraded:
  texlive-bin
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 8348 kB of archives.
After this operation, 2875 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 https://deb.kcubeterm.me/termux-main stable/main aarch64 texlive-bin aarch64 20210325 [8348 kB]
Fetched 8348 kB in 10s (868 kB/s)
(Reading database ... 31239 files and directories currently installed.)
Preparing to unpack .../texlive-bin_20210325_aarch64.deb ...
Unpacking texlive-bin (20210325) over (20200406-10) ...
Setting up texlive-bin (20210325) ...

cat test.tex
\documentclass[a4paper]{article}
\begin{document}
$x^2$
\end{document}

pdflatex test.tex
This is pdfTeX, Version 3.141592653-2.6-1.40.22 (TeX Live 2021/Termux) (preloaded format=pdflatex)
 restricted \write18 enabled.
---! /data/data/com.termux/files/usr/share/texlive/texmf-var/web2c/pdftex/pdflatex.fmt made by different executable version
(Fatal format file error; I'm stymied)

Maybe we need instructions for a complete transiction from 2020 to 2021. I installed TeXLive with the texlive-installer package and with the termux-install-tl script.

@Grimler91
Copy link
Member

@angelog0 please try deleting the format file /data/data/com.termux/files/usr/share/texlive/texmf-var/web2c/pdftex/pdflatex.fmt so that it is re-created with the new pdftex version

@panbroggi
Copy link

@Grimler91 here is the log, it's fdsan again (which can sound reassuring now).
@angelog0 I tried adding a formula and I confirm on my device it works; just to confirm it is probably a configuration error.

@angelog0
Copy link

Ok @Grimler91 and @panbroggi , now it works but I suspect there are others .fmt files that need a refresh. So How to do a complete upgrade from TL2020 to TL2021, mainly for people which installed TL2020 from the termux-install-tl script (ie, from texlive-installe package) ?

amuramatsu pushed a commit to amuramatsu/termux-packages that referenced this issue Jun 26, 2021
Fixes termux/science-packages#50.
With this we can generate the pdflatex format file, and compile tex
files with pdflatex. There might very well be other formats/engines that
still trigger the sanitizer.
@Grimler91
Copy link
Member

@angelog0 do a backup of $PREFIX/share/texlive/texmf-var first just in case. Then run rm -r $PREFIX/share/texlive/texmf-var/web2c to delete all format files. We might need to rm -r $PREFIX/share/texlive/texmf-var to delete the entire texmf-var, but I am not sure if that is necessary

@angelog0
Copy link

angelog0 commented Jun 28, 2021

@Grimler91, I did the following which does not seem to work:

cd $PREFIX/share/texlive
rsync -avc texmf-var/ texmf-var.bkp/
rm texmf-var/web2c -rf

tlmgr --repository $PREFIX/../tlrepo update --list
tlmgr: Local TeX Live (2020) is older tan remote repository (2021).
Cross release update are only supported with
  update-tlmgr-latest(.sh/.exe) -update
See https://tog.org/texlive/upgrade.html for details.

## So
mv texmf-var $PREFIX/tmp/

## and retried
tlmgr --repository $PREFIX/../tlrepo update --list

## WITH THE SAME RESULT

$PREFIX/../tlrepo is a local mirror of TL2021 remote repo whic I use also on macOS and GNU/Linux...

Other suggestions?

BTW, should you update to TL 2021 the texlive-installer package?

@angelog0
Copy link

@Grimler91, I think you have to release texlive-installer-20210325, after which I will rename $PREFIX/share/texlive into $PREFIX/texlive-2020 and then I will reinstall from scratch TeX Live using the termux-install-tl script. As you can read here they suggest to reinstall from scratch.. After all it is what I do on GNU/Linux and macOS since 2007, yearly...

...unless you have a better, and secure, alternative...

..maybe after #72 is fixed..

@angelog0
Copy link

angelog0 commented Jun 30, 2021

After you released the texlive-installer and texlive-bin packages , I installed TL2021 as I described yesterday. I did some tests and it seems to work. Thanks.

@Grimler91
Copy link
Member

@angelog0 great, thanks for testing!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants