[luatex] Problem with package.searchers in TeXLive 2020

Eduardo Ochs eduardoochs at gmail.com
Thu Nov 5 09:14:26 CET 2020

I am getting a strange error with TeXLive 2020 here that I don't get
with TeXLive 2019. The error is:

    attempt to call a nil value (field 'cpath specification')
  stack traceback:
    in local 'lookup'
    in function
        [C]: in function 'require'
        dednat6/dednat6.lua:58: in main chunk
        [C]: in function 'dofile'
        dednat6load.lua:58: in main chunk
        [C]: in function 'dofile'
        [\directlua]:1: in main chunk.
  l.50 \directlua{dofile "dednat6load.lua"}

and what I understood after a few hours trying to debug this is that
the culprit on my side is this chunk of code:

  package.loaders = package.loaders or package.searchers
  local function lualoader(modulename) ... end
  table.insert(package.loaders, 2, lualoader)

in this file:


it seems that my code confuses the part of the code in


that comes from lualibs-package.lua... I tkdiff'ed the versions of
lualibs-package.lua from TeXLive 2019 and TeXLive 2020 by doing

  tkdiff \
    /usr/local/texlive/2019/texmf-dist/tex/luatex/lualibs/lualibs-package.lua \

and I found that the function "helpers" contains this code,

  builtin    = {
      ["preload table"]       = searchers[1+offset], -- special case,
built-in libs
      ["path specification"]  = searchers[2+offset],
      ["cpath specification"] = searchers[3+offset],
      ["all in one fallback"] = searchers[4+offset], -- special case,
combined libs

that supposes that users will not insert their own functions in the
middle of the table package.searchers... but there's a LOT in the code
in lualibs-package.lua that I don't understand - including the parts
that changed from 2019 to 2020.

What should I do? Should I change my code that adds a new searcher to
package.searchers? How? All the users of Dednat6 that I have conctact
with use Dednat6 both on recent TeXLives and on TeXLive 2016/2017 -
for Arxiv-related reasons - so I need to find a solution that works on
as many versions of TeXLive as possible...

  Thanks in advance!
    Eduardo Ochs

More information about the luatex mailing list.