Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LuaLaTeX crashes when lua-widow-control and selnolig packages are used together #43

Closed
stephanlukasczyk opened this issue Jul 15, 2023 · 4 comments
Assignees
Labels
Minor Bug A bug that doesn't completely break a document

Comments

@stephanlukasczyk
Copy link

Issue

Loading lua-widow-control and the selnolig package together crashes LuaLaTeX due to some issue related to the debug library from Lua.

Expected Behavior

I expected that lua-widow-control wouldn't crash LuaLaTeX. When removing the loading of the selnolig package from the MWE, building a PDF succeeds.

Reproduction

\documentclass{scrartcl}
\listfiles
\usepackage{fontspec}% Required for selnolig
\usepackage{selnolig}
\usepackage[debug=true]{lua-widow-control}
\usepackage{blindtext}
\begin{document}
\blinddocument
\end{document}

Log File

This is LuaHBTeX, Version 1.17.0 (TeX Live 2023)  (format=lualatex 2023.7.11)  15 JUL 2023 08:33
 restricted system commands enabled.
**test.tex
(./test.tex
LaTeX2e <2023-06-01> patch level 1
L3 programming layer <2023-06-30>
Lua module: luaotfload 2022-10-03 3.23 Lua based OpenType font support
Lua module: lualibs 2022-10-04 2.75 ConTeXt Lua standard libraries.
Lua module: lualibs-extended 2022-10-04 2.75 ConTeXt Lua libraries -- extended c
ollection.
luaotfload | conf : Root cache directory is "/Users/stephan/Library/texlive/2023
/texmf-var/luatex-cache/generic/names".
luaotfload | init : Loading fontloader "fontloader-2022-10-03.lua" from kpse-res
olved path "/usr/local/texlive/2023/texmf-dist/tex/luatex/luaotfload/fontloader-
2022-10-03.lua".
Lua-only attribute luaotfload@noligature = 1
luaotfload | init : Context OpenType loader version 3.120
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 "/Users/stephan/Library/texlive/2023
/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'. (/usr/local/texlive/202
3/texmf-dist/tex/latex/koma-script/scrartcl.cls
Document Class: scrartcl 2023/07/07 v3.41 KOMA-Script document class (article)
(/usr/local/texlive/2023/texmf-dist/tex/latex/koma-script/scrkbase.sty
Package: scrkbase 2023/07/07 v3.41 KOMA-Script package (KOMA-Script-dependent b
asics and keyval usage)

(/usr/local/texlive/2023/texmf-dist/tex/latex/koma-script/scrbase.sty
Package: scrbase 2023/07/07 v3.41 KOMA-Script package (KOMA-Script-independent 
basics and keyval usage)

(/usr/local/texlive/2023/texmf-dist/tex/latex/koma-script/scrlfile.sty
Package: scrlfile 2023/07/07 v3.41 KOMA-Script package (file load hooks)

(/usr/local/texlive/2023/texmf-dist/tex/latex/koma-script/scrlfile-hook.sty
Package: scrlfile-hook 2023/07/07 v3.41 KOMA-Script package (using LaTeX hooks)


(/usr/local/texlive/2023/texmf-dist/tex/latex/koma-script/scrlogo.sty
Package: scrlogo 2023/07/07 v3.41 KOMA-Script package (logo)
)))
(/usr/local/texlive/2023/texmf-dist/tex/latex/graphics/keyval.sty
Package: keyval 2022/05/29 v1.15 key=value parser (DPC)
\KV@toks@=\toks17
)
Applying: [2021/05/01] Usage of raw or classic option list on input line 252.
Already applied: [0000/00/00] Usage of raw or classic option list on input line
 368.
))
(/usr/local/texlive/2023/texmf-dist/tex/latex/koma-script/tocbasic.sty
Package: tocbasic 2023/07/07 v3.41 KOMA-Script package (handling toc-files)
\scr@dte@tocline@numberwidth=\skip48
\scr@dte@tocline@numbox=\box51
)
Package tocbasic Info: omitting babel extension for `toc'
(tocbasic)             because of feature `nobabel' available
(tocbasic)             for `toc' on input line 133.
Class scrartcl Info: File `scrsize11pt.clo' used instead of
(scrartcl)           file `scrsize11.clo' to setup font sizes on input line 244
1.

(/usr/local/texlive/2023/texmf-dist/tex/latex/koma-script/scrsize11pt.clo
File: scrsize11pt.clo 2023/07/07 v3.41 KOMA-Script font size class option (11pt
)
luaotfload | db : Font names database loaded from /Users/stephan/Library/texlive
/2023/texmf-var/luatex-cache/generic/names/luaotfload-names.luc.gz)
(/usr/local/texlive/2023/texmf-dist/tex/latex/koma-script/typearea.sty
Package: typearea 2023/07/07 v3.41 KOMA-Script package (type area)
\ta@bcor=\skip49
\ta@div=\count183
\ta@hblk=\skip50
\ta@vblk=\skip51
\ta@temp=\skip52
\footheight=\skip53
Package typearea Info: These are the values describing the layout:
(typearea)             DIV  = 10
(typearea)             BCOR = 0.0pt
(typearea)             \paperwidth      = 597.50793pt
(typearea)              \textwidth      = 418.25555pt
(typearea)              DIV departure   = -6%
(typearea)              \evensidemargin = 17.3562pt
(typearea)              \oddsidemargin  = 17.3562pt
(typearea)             \paperheight     = 845.04694pt
(typearea)              \textheight     = 595.80026pt
(typearea)              \topmargin      = -25.16531pt
(typearea)              \headheight     = 17.0pt
(typearea)              \headsep        = 20.40001pt
(typearea)              \topskip        = 11.0pt
(typearea)              \footskip       = 47.6pt
(typearea)              \baselineskip   = 13.6pt
(typearea)              on input line 1799.
)
\c@part=\count184
\c@section=\count185
\c@subsection=\count186
\c@subsubsection=\count187
\c@paragraph=\count188
\c@subparagraph=\count189
\scr@dte@section@maxnumwidth=\skip54
Class scrartcl Info: using compatibility default `runin=bysign'
(scrartcl)           for `\section on input line 5082.
Class scrartcl Info: using compatibility default `afterindent=bysign'
(scrartcl)           for `\section on input line 5082.
\scr@dte@part@maxnumwidth=\skip55
Class scrartcl Info: using compatibility default `afterindent=false'
(scrartcl)           for `\part on input line 5090.
\scr@dte@subsection@maxnumwidth=\skip56
Class scrartcl Info: using compatibility default `runin=bysign'
(scrartcl)           for `\subsection on input line 5100.
Class scrartcl Info: using compatibility default `afterindent=bysign'
(scrartcl)           for `\subsection on input line 5100.
\scr@dte@subsubsection@maxnumwidth=\skip57
Class scrartcl Info: using compatibility default `runin=bysign'
(scrartcl)           for `\subsubsection on input line 5110.
Class scrartcl Info: using compatibility default `afterindent=bysign'
(scrartcl)           for `\subsubsection on input line 5110.
\scr@dte@paragraph@maxnumwidth=\skip58
Class scrartcl Info: using compatibility default `runin=bysign'
(scrartcl)           for `\paragraph on input line 5121.
Class scrartcl Info: using compatibility default `afterindent=bysign'
(scrartcl)           for `\paragraph on input line 5121.
\scr@dte@subparagraph@maxnumwidth=\skip59
Class scrartcl Info: using compatibility default `runin=bysign'
(scrartcl)           for `\subparagraph on input line 5131.
Class scrartcl Info: using compatibility default `afterindent=bysign'
(scrartcl)           for `\subparagraph on input line 5131.
\abovecaptionskip=\skip60
\belowcaptionskip=\skip61
\c@pti@nb@sid@b@x=\box52
Package tocbasic Info: omitting babel extension for `lof'
(tocbasic)             because of feature `nobabel' available
(tocbasic)             for `lof' on input line 6309.
\scr@dte@figure@maxnumwidth=\skip62
\c@figure=\count190
Package tocbasic Info: omitting babel extension for `lot'
(tocbasic)             because of feature `nobabel' available
(tocbasic)             for `lot' on input line 6325.
\scr@dte@table@maxnumwidth=\skip63
\c@table=\count191
Class scrartcl Info: Redefining `\numberline' on input line 6495.
\bibindent=\dimen139
)
(/usr/local/texlive/2023/texmf-dist/tex/latex/fontspec/fontspec.sty
(/usr/local/texlive/2023/texmf-dist/tex/latex/l3packages/xparse/xparse.sty
(/usr/local/texlive/2023/texmf-dist/tex/latex/l3kernel/expl3.sty
Package: expl3 2023-06-30 L3 programming layer (loader) 

(/usr/local/texlive/2023/texmf-dist/tex/latex/l3backend/l3backend-luatex.def
File: l3backend-luatex.def 2023-04-19 L3 backend support: PDF output (LuaTeX)
\l__color_backend_stack_int=\count192
Inserting `l3color' in `luaotfload.parse_color'.
\l__pdf_internal_box=\box53
))
Package: xparse 2023-02-02 L3 Experimental document command parser
)
Package: fontspec 2022/01/15 v2.8a Font selection for XeLaTeX and LuaLaTeX
Lua module: fontspec 2022/01/15 2.8a Font selection for XeLaTeX and LuaLaTeX (/
usr/local/texlive/2023/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty
Package: fontspec-luatex 2022/01/15 v2.8a Font selection for XeLaTeX and LuaLaT
eX
\l__fontspec_script_int=\count193
\l__fontspec_language_int=\count194
\l__fontspec_strnum_int=\count195
\l__fontspec_tmp_int=\count196
\l__fontspec_tmpa_int=\count197
\l__fontspec_tmpb_int=\count198
\l__fontspec_tmpc_int=\count199
\l__fontspec_em_int=\count266
\l__fontspec_emdef_int=\count267
\l__fontspec_strong_int=\count268
\l__fontspec_strongdef_int=\count269
\l__fontspec_tmpa_dim=\dimen140
\l__fontspec_tmpb_dim=\dimen141
\l__fontspec_tmpc_dim=\dimen142

(/usr/local/texlive/2023/texmf-dist/tex/latex/base/fontenc.sty
Package: fontenc 2021/04/29 v2.0v Standard LaTeX package
)
(/usr/local/texlive/2023/texmf-dist/tex/latex/fontspec/fontspec.cfg)))
(/usr/local/texlive/2023/texmf-dist/tex/lualatex/selnolig/selnolig.sty
=== Package selnolig, Version 0.302, Date 2015/10/26 ===
Package: selnolig 2015/10/26
(/usr/local/texlive/2023/texmf-dist/tex/generic/iftex/ifluatex.sty
Package: ifluatex 2019/10/25 v1.5 ifluatex legacy package. Use iftex instead.

(/usr/local/texlive/2023/texmf-dist/tex/generic/iftex/iftex.sty
Package: iftex 2022/02/03 v1.0f TeX engine tests
))
(/usr/local/texlive/2023/texmf-dist/tex/luatex/luatexbase/luatexbase.sty
Package: luatexbase 2015/10/04 v1.3 luatexbase interface to LuaTeX 

(/usr/local/texlive/2023/texmf-dist/tex/luatex/ctablestack/ctablestack.sty
Package: ctablestack 2015/10/01 v1.0 Catcode table stable support
\@catcodetablestackcnt=\count270
)
\CatcodeTableOther=\catcodetable14
\CatcodeTableExpl=\catcodetable15
)
Inserting `Suppress ligatures selectively' in `ligaturing'.)
(/usr/local/texlive/2023/texmf-dist/tex/lualatex/lua-widow-control/lua-widow-co
ntrol.sty
Package: lua-widow-control 2022/11/22 vv3.0.0 Use Lua to remove widows and orph
ans
\g__lwc_emergencystretch_dim=\dimen143
\g__lwc_draftoffset_dim=\dimen144
\g__lwc_maxcost_int=\count271
Lua module: lua-widow-control 2022/11/22 3.0.0 
This module provides a LuaTeX-based solution to prevent
widows and orphans from appearing in a document. It does
so by increasing or decreasing the lengths of previous
paragraphs.
Lua-only attribute lua-widow-control_paragraph = 4
Lua-only attribute lua-widow-control_insert = 5
Lua function __lwc_if_enabled: = 25
Lua function __lwc_enable: = 26
Lua function __lwc_disable: = 27
Lua function __lwc_nobreak:n = 28
Lua function __lwc_debug:n = 29
Lua function __lwc_show_costs:n = 30
Lua function __lwc_show_colours:n = 31
Lua function __lwc_pre_shipout:n = 32...-dist/tex/luatex/lua-widow-control/lua-w
idow-control.lua:1735: attempt to index a boolean value (upvalue 'debug_lib').
<argument> \__lua_load_module_p:n {lua-widow-control}
                                          
l.124 }
     
? x


Here is how much of LuaTeX's memory you used:
 5871 strings out of 477545
 100000,1977958 words of node,token memory allocated 407 words of node memory still in use:
   2 hlist, 1 rule, 1 dir, 3 kern, 1 glyph, 4 attribute, 52 glue_spec, 4 attribu
te_list, 2 if_stack, 1 write, 1 user_defined nodes
   avail lists: 1:1,2:17,3:2,5:6,7:29,9:3,11:3
 26871 multiletter control sequences out of 65536+600000
 16 fonts using 855119 bytes
 108i,1n,101p,10908b,273s 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)

Format

LaTeX

Distribution

TeX Live

Distribution Version

2023

Lua-widow-control Version

3.0.0 (2022/11/22)

Other Relevant Packages and Versions

selnolig — 0.302 (2015/10/26)

Other

No response

@stephanlukasczyk stephanlukasczyk added the Minor Bug A bug that doesn't completely break a document label Jul 15, 2023
@stephanlukasczyk
Copy link
Author

Just found out that this seems to be caused by selnolig and not lua-widow-control, e.g., see zauguin/luaul#3 and micoloretan/selnolig#10. Since the author of selnolig did not release the fix for a couple of years now, could you imagine to have some workaround for the issue, maybe?

@gucci-on-fleek
Copy link
Owner

So selnolig.sty has these lines

  \newcommand\debugon{%
     \directlua{ debug=true }
  }
  \newcommand\debugoff{% 
     \directlua{ debug=false }
  }

which, as you've read in the linked issues, globally overwrites the Lua debug library. 3 possible solutions for this:

  1. Restore the original debug library:
    \documentclass{article}
    
    \usepackage{fontspec}
    \usepackage{selnolig}
    
    \directlua{debug=require"debug";debug_info=function()end}
    \usepackage{lua-widow-control}
    
    \begin{document}
        Hello world!
    \end{document}
  2. Use the secret method to prevent lua-widow-control from using the debug library:
    \documentclass{article}
    
    \usepackage{fontspec}
    \usepackage{selnolig}
    
    \directlua{LWC_NO_DEBUG=true}
    \usepackage{lua-widow-control}
    
    \begin{document}
        Hello world!
    \end{document}
  3. Load lua-widow-control first:
    \documentclass{article}
    
    \usepackage{lua-widow-control}
    
    \usepackage{fontspec}
    \usepackage{selnolig}
    
    \begin{document}
        Hello world!
    \end{document}

The real solution here would be to patch selnolig, but considering the dates on the linked issues, that's probably not going to happen.

A more realistic solution here would be for me to patch the lua-widow-control source to work around this. I can't say that I'm terribly excited about needing a patch to fix a broken third-party package, but it's literally a two-line fix so I see no reason not to apply it.

@gucci-on-fleek
Copy link
Owner

gucci-on-fleek commented Jul 15, 2023

Alright, this should be fixed 7c4544c. As soon as I get the build system to work again, I'll make a release and send it off to CTAN. After I submit it to CTAN, it usually takes about 2 days to make its way into TL, but this might take a little longer than usual since TUG2023 is running right now.

@stephanlukasczyk
Copy link
Author

Thank you very much for the quick fix. No worries about the time for publication on CTAN, it's not really urgent, and I am also sitting in the audience of the TUG conference right now 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Minor Bug A bug that doesn't completely break a document
Projects
None yet
Development

No branches or pull requests

2 participants