#1121307 lpdf-lmt.lmt:1681: attempt to perform bitwise operation on a nil value (local 'options')

#1121307#5
Date:
2025-11-24 11:53:20 UTC
From:
To:
Dear Maintainers,

ConTeXt in both trixie and testing is nearly unuseable because of problems
with LatinModernMath-Companion.otf file. This in turn causes exception in lua
as in Subject. This happens on most TeX files, unless the font is changed.
See steps to reproduce for minimal example file.

In testing it also reproduces, but with slightly different font filename.

Installing and uninstalling context-modules (recommended) causes the message
to change, but still there's a problem with this 'options' local lua variable.

Here's a relevant SO question with no real solution (suggested solution is to
install from upstream):
https://tex.stackexchange.com/questions/741248/context-crashes-on-every-document-inside-luametatex

Thank you in advance,
woju

#1121307#10
Date:
2025-11-30 16:30:37 UTC
From:
To:
On 11/24/2025 12:53 PM, debbugs@gdpr.woju.eu wrote:

Hello,
I'll try have a look at the issue.

Please don't send E-Mails having a size of > 100K to the TeX Bug
tracker, they won't make it into our mailing list [1] and I won't see
it. I'll insert a bug script informing about that fact.

Hilmar

[1] https://lists.debian.org/debian-tex-maint/2025/11/threads.html

#1121307#15
Date:
2026-10-18 15:16:18 UTC
From:
To:
On 11/24/25 12:53 PM, debbugs@gdpr.woju.eu wrote:

Hello,

I tried to reproduce the issue inside my change root and failed. I can
compile your example fine and in the document LatinModern is used:

(arm64-sid)hille@rasppi3:~$ pdffonts test.pdf
name                                 type              encoding
emb sub uni object ID
------------------------------------ ----------------- ---------------- 
--- --- --- ---------
ONKMFC+LMRoman10-Regular             CID Type 0C       Identity-H
yes yes yes      2  0
<snip>

Could it have been an issue in mimalloc, which has been solved in the
meantime? Are you still able to reproduce? Do you have package
"fonts-lmodern" installed?
I'm wondering a little bit, why your call to actually process the TeX
input file, again regenerates the format file, but this could be irrelevant.

Hilmar

#1121307#20
Date:
2026-10-19 20:26:35 UTC
From:
To:
Hello! Thank you for looking into this.

I know nothing about mimalloc bug you've mentioned, but I'd be surprised if
this bug was related to memory allocation, because the error seems to mention
stuff related to parsing the font file (?) in lua (?). Not impossible though.

Yes, I can reproduce, on apt-get-upgrade'd trixie. I have fonts-lmodern
2.005-1. Please check the dpkg -l output yourself in case I misunderstood
something. Here you have the relevant stuff, resulting after failed `context
test.tex` incantation.


% ls -l
total 68
-rw-rw-r-- 1 woju woju  2172 Oct 19 14:58 test-error.log
-rw-rw-r-- 1 woju woju 50634 Oct 19 14:58 test.log
-rw-rw-r-- 1 woju woju  4171 Oct 19 14:58 test.pdf
-rw-rw-r-- 1 woju woju    52 Oct 19 14:57 test.tex

% cat test.tex
\starttext
\bTABLE\bTR\bTD\eTD\eTR\eTABLE
\stoptext

% pdffonts test.pdf
name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
WURDFA+LMMonoPropLt10-Regular        CID Type 0C       Identity-H       yes yes yes      1  0

% tail -n50 test.log
fonts           > otf loading > loading '/usr/share/texmf/fonts/opentype/public/context-companion-fonts/LatinModernMath-Companion.otf', hash 'latinmodernmath-companion'
otf reader      > unknown version '{"pa' in file '/usr/share/texmf/fonts/opentype/public/context-companion-fonts/LatinModernMath-Companion.otf'
fonts           > otf loading > loading done
fonts           > otf loading > saving '/usr/share/texmf/fonts/opentype/public/context-companion-fonts/LatinModernMath-Companion.otf' in cache
system          > lua > compiling '/home/woju/.texlive2025/texmf-var/luametatex-cache/context/f919750633122078d706dd10f1cfd39b/fonts/otl/latinmodernmath-companion.tma' into '/home/woju/.texlive2025/texmf-var/luametatex-cache/context/f919750633122078d706dd10f1cfd39b/fonts/otl/latinmodernmath-companion.tmd'
system          > lua > dumping '/home/woju/.texlive2025/texmf-var/luametatex-cache/context/f919750633122078d706dd10f1cfd39b/fonts/otl/latinmodernmath-companion.tma' into '/home/woju/.texlive2025/texmf-var/luametatex-cache/context/f919750633122078d706dd10f1cfd39b/fonts/otl/latinmodernmath-companion.tmd' stripped
fonts           > otf loading > loading, optimizing, packing and caching time 0.001
fonts           > otf loading > missing specification
fonts           > otf loading > missing specification
fonts           > otf loading > missing specification
fonts           > otf loading > missing specification
fonts           > otf loading > missing specification
fonts           > otf loading > missing specification
fonts           > otf loading > missing specification
fonts           > otf loading > missing specification
fonts           > otf loading > missing specification
fonts           > otf loading > missing specification
fonts           > otf loading > missing specification
fonts           > otf loading > missing specification
fonts           > otf loading > missing specification
fonts           > otf loading > missing specification
mathematics     > initializing > font 'LatinModernMath-Companion.otf*tweakreplacealphabets1' doesn't exist
fonts           > otf loading > loading '/usr/share/texmf/fonts/opentype/public/context-companion-fonts/LatinModernMath-Companion.otf', hash 'latinmodernmath-companion'
otf reader      > unknown version '{"pa' in file '/usr/share/texmf/fonts/opentype/public/context-companion-fonts/LatinModernMath-Companion.otf'
fonts           > otf loading > loading done
fonts           > otf loading > saving '/usr/share/texmf/fonts/opentype/public/context-companion-fonts/LatinModernMath-Companion.otf' in cache
system          > lua > compiling '/home/woju/.texlive2025/texmf-var/luametatex-cache/context/f919750633122078d706dd10f1cfd39b/fonts/otl/latinmodernmath-companion.tma' into '/home/woju/.texlive2025/texmf-var/luametatex-cache/context/f919750633122078d706dd10f1cfd39b/fonts/otl/latinmodernmath-companion.tmd'
system          > lua > dumping '/home/woju/.texlive2025/texmf-var/luametatex-cache/context/f919750633122078d706dd10f1cfd39b/fonts/otl/latinmodernmath-companion.tma' into '/home/woju/.texlive2025/texmf-var/luametatex-cache/context/f919750633122078d706dd10f1cfd39b/fonts/otl/latinmodernmath-companion.tmd' stripped
fonts           > otf loading > loading, optimizing, packing and caching time 0.001
fonts           > otf loading > missing specification
fonts           > otf loading > missing specification
fonts           > otf loading > missing specification
fonts           > otf loading > missing specification
fonts           > otf loading > missing specification
fonts           > otf loading > missing specification
fonts           > otf loading > missing specification
fonts           > otf loading > missing specification
fonts           > otf loading > missing specification
fonts           > otf loading > missing specification
fonts           > otf loading > missing specification
fonts           > otf loading > missing specification
fonts           > otf loading > missing specification
fonts           > otf loading > missing specification
mathematics     > initializing > font 'LatinModernMath-Companion.otf*tweakreplacealphabets1' doesn't exist
fonts           > 'fallback modern rm 12pt' is loaded
tex error       > tex error on line 1 in file ./test.tex:
1 >>  \starttext
2     \bTABLE\bTR\bTD\eTD\eTR\eTABLE
3     \stoptext
4

% cat test-error.log
return {
 ["filename"]="./test.tex",
 ["lastcontext"]="",
 ["lastluaerror"]="registered function call [254]: /usr/share/texmf/tex/context/base/mkxl/lpdf-lmt.lmt:1681: attempt to perform bitwise operation on a nil value (local 'options')\nstack traceback:\n	/usr/share/texmf/tex/context/base/mkxl/lpdf-lmt.lmt:1681: in upvalue 'flushrule'\n	/usr/share/texmf/tex/context/base/mkxl/driv-shp.lmt:1659: in upvalue 'vlist_out'\n	/usr/share/texmf/tex/context/base/mkxl/driv-shp.lmt:1196: in upvalue 'hlist_out'\n	/usr/share/texmf/tex/context/base/mkxl/driv-shp.lmt:1198: in upvalue 'hlist_out'\n	/usr/share/texmf/tex/context/base/mkxl/driv-shp.lmt:1198: in upvalue 'hlist_out'\n	/usr/share/texmf/tex/context/base/mkxl/driv-shp.lmt:1198: in upvalue 'hlist_out'\n	/usr/share/texmf/tex/context/base/mkxl/driv-shp.lmt:1198: in upvalue 'hlist_out'\n	/usr/share/texmf/tex/context/base/mkxl/driv-shp.lmt:1625: in upvalue 'vlist_out'\n/usr/share/texmf/tex/context/base/mkxl/driv-shp.lmt:1196: in upvalue 'hlist_out'\n	/usr/share/texmf/tex/context/base/mkxl/driv-shp.lmt:1625: in upvalue 'vlist_out'\n	...	(skipping 6 levels)\n	/usr/share/texmf/tex/context/base/mkxl/driv-shp.lmt:1196: in upvalue 'hlist_out'\n	/usr/share/texmf/tex/context/base/mkxl/driv-shp.lmt:1625: in upvalue 'vlist_out'\n	/usr/share/texmf/tex/context/base/mkxl/driv-shp.lmt:1623: in upvalue 'vlist_out'\n	/usr/share/texmf/tex/context/base/mkxl/driv-shp.lmt:1623: in upvalue 'vlist_out'\n	/usr/share/texmf/tex/context/base/mkxl/driv-shp.lmt:1196: in upvalue 'hlist_out'\n/usr/share/texmf/tex/context/base/mkxl/driv-shp.lmt:1198: in upvalue 'hlist_out'\n	/usr/share/texmf/tex/context/base/mkxl/driv-shp.lmt:1198: in upvalue 'hlist_out'\n	/usr/share/texmf/tex/context/base/mkxl/driv-shp.lmt:1625: in upvalue 'vlist_out'\n/usr/share/texmf/tex/context/base/mkxl/driv-shp.lmt:1799: in upvalue 'converter'\n	/usr/share/texmf/tex/context/base/mkxl/lpdf-lmt.lmt:3719: in upvalue 'convert'\n	/usr/share/texmf/tex/context/base/mkxl/driv-ini.lmt:211: in function </usr/share/texmf/tex/context/base/mkxl/driv-ini.lmt:207>\n	(...tail calls...)",
 ["lasttexerror"]="",
 ["linenumber"]=1,
 ["offset"]=10,
 ["skiplinenumber"]=1,
}

% dpkg -l context\* fonts-lmodern liblua\* libmimalloc3 luametatex
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                Version                       Architecture Description
+++-===================-=============================-============-============================================================
ii  context             2024.04.01.20240428+dfsg-2    all          powerful TeX format
un  context-doc-nonfree <none>                        <none>       (no description available)
ii  context-modules     20240428-5                    all          additional ConTeXt modules
un  context-nonfree     <none>                        <none>       (no description available)
ii  fonts-lmodern       2.005-1                       all          OpenType fonts based on Computer Modern
ii  liblua5.1-0:amd64   5.1.5-11                      amd64        Shared library for the Lua interpreter version 5.1
ii  liblua5.3-0:amd64   5.3.6-2+b4                    amd64        Shared library for the Lua interpreter version 5.3
ii  liblua5.4-0:amd64   5.4.7-1+b2                    amd64        Shared library for the Lua interpreter version 5.4
ii  libmimalloc3:amd64  3.0.1+ds-2.1                  amd64        compact general purpose allocator with excellent performance
ii  luametatex          2.11.02+really2.11.01+ds-1+b1 amd64        Next generation ConTeXt processing engine


The log contains many more stanzas of „initialising > font” plus many „missing
specification” lines. There's a difference in pdffonts output, but I don't
understand it (and I haven't snipped anything, it is this single line). The
error backtrace is familiar.

I've also tested with libmimalloc 3.5.3+ds-1~bpo13+1, the result is the same.
I didn't test anything on forky or other newer packages, should I?

The file in question seems to be intact:

% dpkg -S /usr/share/texmf/fonts/opentype/public/context-companion-fonts/LatinModernMath-Companion.otf
context-modules: /usr/share/texmf/fonts/opentype/public/context-companion-fonts/LatinModernMath-Companion.otf
% dpkg -V context-modules
% sha256sum /usr/share/texmf/fonts/opentype/public/context-companion-fonts/LatinModernMath-Companion.otf
6b47afe0388d8f4a0a10872102ba40464f30be3c3409f37ab493b5b13c3fc61f  /usr/share/texmf/fonts/opentype/public/context-companion-fonts/LatinModernMath-Companion.otf

Probably because in clean docker, in which I've performed the original test,
you need to generate the format during compilation of the first document.
Unless shown otherwise, I'd concur this should be irrelevant. In any case,
I've tested also after `mtxrun --generate`, same thing happens every time.


Thank you again,