On 3/6/2025 9:40 AM, Max Chernoff via ntg-context wrote:
Hi Hans,

Someone posted on the tlbuild mailing list that LuaMetaTeX segfaults
whenever making the ConTeXt format on OpenBSD. I'm all out of ideas for
how to fix this, so hopefully you have some suggestions? The original
thread started at

     https://tug.org/pipermail/tlbuild/2025q1/005651.html

it seems that we need an extra safeguard .. see below

Thanks,
-- Max

-------- Forwarded Message --------
From: Robert Alessi <ale...@robertalessi.net>
To: Max Chernoff <t...@maxchernoff.ca>
Cc: tlbu...@tug.org
Subject: Re: [tlbuild] TL25 rebuild please
Date: 2025-03-06 12:15:08 AM

Hi Max,

On Wed, Mar 05, 2025 at 01:00:57AM -0700, Max Chernoff wrote:
folder, you can build a debug version with:

     $ export CFLAGS='-ggdb3 -O0' CXXFLAGS='-ggdb3 -O0' LDFLAGS='-ggdb3'
     $ sed -i '/-O3/d' CMakeLists.txt
     $ sed -i 's/"-s"/""/' CMakeLists.txt
     $ sed -i '/STRIP/d' cmake/luametatex.cmake
     $ mkdir debug/ && cd debug/
     $ cmake -DCMAKE_BUILD_TYPE=Debug -DLMT_PERMIT_LUA_LIBRARIES=yes ..

At this point I got this CMake warning:

CMake Warning:
   Manually-specified variables were not used by the project:

     LMT_PERMIT_LUA_LIBRARIES

     $ cmake --build . --parallel 16

Then the build process succeeded.


The command to manually build a format is

     $ luametatex --ini --lua=$(kpsewhich luat-cod.lmt) $(kpsewhich 
cont-en.mkxl)

Since you compiled with clang, I guess you'll probably use lldb, but
with GDB and an intentionally-broken binary, this is what I get:

     $ gdb --args luametatex --ini --lua=$(kpsewhich luat-cod.lmt) $(kpsewhich 
cont-en.mkxl)

Then I copied luametatex to my TL bin dir and I ran:

$ lldb --arch x86_64 -- luametatex --ini --lua=$(kpsewhich luat-cod.lmt) 
$(kpsewhich cont-en.mkxl)

Here is what I got:

(lldb) target create --arch=x86_64 "luametatex"
Current executable set to '/usr/local/texlive/2025/bin/custom/luametatex' 
(x86_64).
(lldb) settings set -- target.run-args  "--ini" 
"--lua=/usr/local/texlive/2025/texmf-dist/tex/context/base/mkxl/luat-cod.lmt" 
"/usr/local/texlive/2025/texmf-dist/tex/context/base/mkxl/cont-en.mkxl"
(lldb) r
Process 28175 launched: '/usr/local/texlive/2025/bin/custom/luametatex' (x86_64)
This is LuaMetaTeX, Version 2.11.07 initex
(/usr/local/texlive/2025/texmf-dist/tex/context/base/mkxl/cont-en.mkxl(context.mkxl(syst-ini.mkxl)(norm-ctx.mkxl)(syst-pln.mkxl)(luat-cod.mkxl<+
 /usr/local/texlive/2025/texmf-dist/tex/context/base/mkxl
[...]
open source     > level 1, order 35, name 'core-ini.mkxl'
loading         > ConTeXt Core Macros / Additional Initialization
close source    > level 1, order 35, name 'core-ini.mkxl'
open source     > level 1, order 36, name 'core-env.mkxl'
loading         > ConTeXt Core Macros / Environments
Process 28175 stopped
* thread #1, stop reason = signal SIGSEGV
     frame #0: 0x000009667aa8c9d8 luametatex`texlib_aux_checked_register [inlined] 
texlib_aux_valid_register_index(L=0x000009691de9f708, slot=1, cmd=<unavailable>, 
base=<unavailable>, max=65535, constant_cmd=<unavailable>) at lmttexlib.c:1277:74
    1274     }
    1275     if (index >= 0 && index <= max) {
    1276         return index;
-> 1277     } else if (index < (eqtb_size + lmt_hash_state.hash_data.ptr + 1) 
&& eq_type(index) == constant_cmd) {

} else if (index > 0 && index < (eqtb_size + lmt_hash_state.hash_data.ptr + 1) && eq_type(index) == constant_cmd) {

but here i will do a bit more
^
    1278         return index;
    1279     } else {
    1280         return -1;
(lldb) q
Quitting LLDB will kill one or more processes. Do you really want to proceed: 
[Y/n] Y

Thanks again,

-- Robert


Thanks,
-- Max

i'll do an update (with a few more safeguards) but need to run the test suite first and i'm off line in a few hours so probably tomorrow

Hans

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
       tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

Reply via email to