[Dev-luatex] require doesn't get recorded
Marcel Fabian Krüger
tex at 2krueger.de
Thu Nov 7 15:21:03 CET 2019
Hi,
based on an observation by Karl Berry on the TeX Live list I discovered
an inconsistency in LuaTeX's handling of `-recorder`: While LuaTeX does
record files loaded through `loadfile`, files loaded through `require`
are ignored:
For example if the current directory contains two empty files l1.lua and
l2.lua, then the document
\directlua{
loadfile'l1.lua'()
require'l2'
}
\bye
compiled with `luatex -recorder recorded` IMO should write to
recorded.fls the entries
PWD /some/weird/pwd
INPUT /usr/local/texlive/2019/texmf-var/web2c/luatex/luatex.fmt
INPUT ./recorded.tex
OUTPUT recorded.log
INPUT l1.lua
INPUT ./l2.lua
but it does write
PWD /some/weird/pwd
INPUT /usr/local/texlive/2019/texmf-var/web2c/luatex/luatex.fmt
INPUT ./recorded.tex
OUTPUT recorded.log
INPUT l1.lua
I do not think that this is intentional, so I added a patch to add
recorder entries iff the file is loaded successfully (similar to
`loadfile`)
-- Marcel
-------------- next part --------------
>From fd35512137fdf94439427a46f7b6c010a9b0aa6a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcel=20Fabian=20Kr=C3=BCger?= <tex at 2krueger.de>
Date: Thu, 7 Nov 2019 12:18:08 +0100
Subject: [PATCH] Record required files
---
source/texk/web2c/luatexdir/lua/luainit.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/source/texk/web2c/luatexdir/lua/luainit.c b/source/texk/web2c/luatexdir/lua/luainit.c
index 7570910b0..615a03706 100644
--- a/source/texk/web2c/luatexdir/lua/luainit.c
+++ b/source/texk/web2c/luatexdir/lua/luainit.c
@@ -682,6 +682,7 @@ static int luatex_kpse_lua_find(lua_State * L)
lua_tostring(L, 1), filename, lua_tostring(L, -1));
}
/*tex library loaded successfully */
+ recorder_record_input(filename);
return 1;
}
@@ -771,6 +772,9 @@ static int luatex_kpse_clua_find(lua_State * L)
free(extensionless);
free(total);
free(temp_name);
+ if (lua_isfunction(L, -1)) {
+ recorder_record_input(filename);
+ }
return 1;
}
}
--
2.24.0
More information about the dev-luatex
mailing list