You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When adding several functions with the same descriptions,
there is no warning or error, so if a user does not do any checking
he may add a function with description that is already exists
in the callback, then he may accidentally remove the wrong
function.
What is the expected usage here? Use a prefix as
a name space? check for the existence of such
description before adding the function?
or should there be a test in ltluatex?
Minimal example showing the bug
\directlua{
luatexbase.create_callback("foo", "data", false)
luatexbase.add_to_callback("foo", function() print("bar") return true end, "foo")
luatexbase.add_to_callback("foo", function() print("baz") return true end, "foo")
for _, desc in ipairs(luatexbase.callback_descriptions("foo")) do print(desc) end
print("================================")
luatexbase.remove_from_callback("foo", "foo")
for _, desc in ipairs(luatexbase.callback_descriptions("foo")) do print(desc) end
print("================================")
luatexbase.call_callback("foo")
}
\stop
This is LuaHBTeX, Version 1.18.0 (TeX Live 2024) (format=lualatex 2025.1.1) 12 JAN 2025 15:34
restricted system commands enabled.
**lualineno
(./lualineno.tex
LaTeX2e <2024-11-01> patch level 1
L3 programming layer <2024-12-09>
Lua module: luaotfload 2024-02-14 v3.28 Lua based OpenType font support
Lua module: lualibs 2023-07-13 v2.76 ConTeXt Lua standard libraries.
Lua module: lualibs-extended 2023-07-13 v2.76 ConTeXt Lua libraries -- extended
collection.
luaotfload | conf : Root cache directory is "/home/udico/.texlive2024/texmf-var/
luatex-cache/generic/names".
luaotfload | init : Loading fontloader "fontloader-2023-12-28.lua" from kpse-res
olved path "/usr/local/texlive/2024/texmf-dist/tex/luatex/luaotfload/fontloader-
2023-12-28.lua".
Lua-only attribute luaotfload@noligature = 1
luaotfload | init : Context OpenType loader version 3.134
Inserting `luaotfload.node_processor' in `pre_linebreak_filter'.
Inserting `luaotfload.node_processor' in `hpack_filter'.
Inserting `luaotfload.glyph_stream' in `glyph_stream_provider'.
Inserting `luaotfload.define_font' in `define_font'.
Lua-only attribute luaotfload_color_attribute = 2
luaotfload | conf : Root cache directory is "/home/udico/.texlive2024/texmf-var/
luatex-cache/generic/names".
Inserting `luaotfload.harf.strip_prefix' in `find_opentype_file'.
Inserting `luaotfload.harf.strip_prefix' in `find_truetype_file'.
Removing `luaotfload.glyph_stream' from `glyph_stream_provider'.
Inserting `luaotfload.harf.glyphstream' in `glyph_stream_provider'.
Inserting `luaotfload.harf.finalize_vlist' in `post_linebreak_filter'.
Inserting `luaotfload.harf.finalize_hlist' in `hpack_filter'.
Inserting `luaotfload.cleanup_files' in `wrapup_run'.
Inserting `luaotfload.harf.finalize_unicode' in `finish_pdffile'.
Inserting `luaotfload.glyphinfo' in `glyph_info'.
Lua-only attribute luaotfload.letterspace_done = 3
Inserting `luaotfload.aux.set_sscale_dimens' in `luaotfload.patch_font'.
Inserting `luaotfload.aux.set_font_index' in `luaotfload.patch_font'.
Inserting `luaotfload.aux.patch_cambria_domh' in `luaotfload.patch_font'.
Inserting `luaotfload.aux.fixup_fontdata' in `luaotfload.patch_font_unsafe'.
Inserting `luaotfload.aux.set_capheight' in `luaotfload.patch_font'.
Inserting `luaotfload.aux.set_xheight' in `luaotfload.patch_font'.
Inserting `luaotfload.rewrite_fontname' in `luaotfload.patch_font'.
Inserting `tracingstacklevels' in `input_level_string'.
Inserting `foo' in `foo'.
Inserting `foo' in `foo'.
Removing `foo' from `foo'.)
Here is how much of LuaTeX's memory you used:
16 strings out of 475554
100000,552014 words of node,token memory allocated
339 words of node memory still in use:
2 hlist, 1 vlist, 2 glue, 3 kern, 1 glyph, 3 attribute, 39 glue_spec, 3 attri
bute_list, 1 write nodes
avail lists: 2:7,3:2,4:1,5:2,7:1,9:1
23099 multiletter control sequences out of 65536+600000
14 fonts using 591679 bytes
12i,1n,13p,92b,15s stack positions out of 10000i,1000n,20000p,200000b,200000s
warning (pdf backend): no pages of output.
PDF statistics: 0 PDF objects out of 1000 (max. 8388607)
0 named destinations out of 1000 (max. 131072)
1 words of extra memory for PDF output out of 10000 (max. 100000000)
The text was updated successfully, but these errors were encountered:
certainly the description despite its name, is essentially the unique identifier for the function, so adding two with the same is user error. I suppose the question is whether add_to_callback should error if there is already a function with that description in the specified callback, or whether this should be left to the documentation (which could be clearer on this point)
Yes, that what I was thinking. Initially I thought there was some convention in LaTeX seeing luaofload, luacolor and babel using the package name as a prefix, but not all packages are doing so...
Brief outline of the bug
When adding several functions with the same descriptions,
there is no warning or error, so if a user does not do any checking
he may add a function with description that is already exists
in the callback, then he may accidentally remove the wrong
function.
What is the expected usage here? Use a prefix as
a name space? check for the existence of such
description before adding the function?
or should there be a test in ltluatex?
Minimal example showing the bug
Log file (required) and possibly PDF file
The text was updated successfully, but these errors were encountered: