markdown: Compile error with fresh MiKTeX installation
Hello, I’ve recently ran into a problem that causes markdown to fail with the following error message:
...a/Local/Programs/MiKTeX/tex/luatex/markdown/markdown.lua:3237: bad argument #1 to 'open' (string expected, got nil)
stack traceback:
[C]: in function 'io.open'
...a/Local/Programs/MiKTeX/tex/luatex/markdown/markdown.lua:3237: in function <...a/Local/Programs/MiKTeX/tex/luatex/markdown/markdown.lua:3235>
...a/Local/Programs/MiKTeX/tex/luatex/markdown/markdown.lua:3235: in main chunk
[C]: in function 'require'
[\directlua]:1: in main chunk.
\lua_now:e #1->\__lua_now:n {#1}
l.8 \end{markdown}
The lua interpreter ran into a problem, so the
remainder of this lua chunk will be ignored.
Here are my steps to reproduce:
-
Create a fresh Windows 11 VM
-
Install the most recent version of MiKTeX
-
Create file
document.tex\documentclass{article} \usepackage{markdown} \begin{document} Hello World! \begin{markdown} _Hello,_ **Markdown**! \end{markdown} \end{document} -
Run
lualatex --interaction=nonstopmode --shell-escape --synctex=1 document.tex -
The above error occurs.
In the resulting PDF, only the “Hello World” part is there, the “Hello Markdown” part is missing. I have attached the full log file: document.log
Since everything is a fresh install, all packages are up-to-date.
Interestingly, on a different system where I haven’t updated my MiKTeX packages in a while,
I still have markdown version 2.23.0-0-g0b22f91 installed, and everything works fine there.
Please let me know if I can help you with any additional information.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 29 (20 by maintainers)
Thanks for your analysis. I hoped that https://github.com/Witiko/markdown/pull/482 would also help here besides improving the speed.
Please note that https://github.com/Witiko/markdown/pull/482 is not yet finished, see the failing CI. For some reason, the parser does not match some punctuation symbols such as “€”, likely due to some obscure typo in my depth-first search algorithm.
As also discussed in https://github.com/Witiko/markdown/pull/482, I would like to remove the dependency on
UnicodeData.txtand precompile the parser into a Lua filemarkdown-unicode-data.luathat would be distributed together with the Markdown package. That way, we should be fully compatible with MikTeX.I confirmed that the issue is with MikTeX under Windows:
I will now look into whether the issue is also present with TeX Live under Windows.
I dug a bit deeper into this. I disabled various parsers (by setting them to
P(false)) and worked my way upwards the whole parser chain to see what causes the crash. And I think I found it.The crash occurs in the
check_unicode_typefunction. Specifically, in the line that readsif lpeg.match(parsers.punctuation[char_length], s, i+pos) then.As you can see in the console output, line 4982 got hit, but neither did 4987 nor 4990.
Earlier in the code, the
parsers.punctuationtable is loaded from theUnicodeData.txtfile. Could there be something wrong with this file or how it is read under Windows? I downloaded the file from https://ctan.joethei.xyz/macros/generic/unicode-data/UnicodeData.txt and double-checked that it is intact.With the
[plain]option, I got the same result:I then ran the
markdown-cli.luascript with theexample.mdfile. Afer a few seconds, the script exited with code-1073741571and produced no output.I have tested it again on a fresh Windows 11 VM, with the same steps as in my initial comment, but with the additional
UnicodeData.txtfile. Unfortunately I ran into the same problem you described yesterday. I took this screenshot right after the process crashed.I have attached the log file: document.log
I then tested it again on anther VM with twice the assigned memory (16 GB total), but with the same result. I’m fairly confident in saying that this is not an insufficient memory issue.
Please let me know if I can test additional things for you, I’m happy to help you investigate this problem.