lyluatex icon indicating copy to clipboard operation
lyluatex copied to clipboard

Lyluatex fails to compile documents in GitHub Actions

Open Witiko opened this issue 3 years ago • 8 comments

At witiko/lyluatex-github-actions-example, I created a simple MWE that shows Lyluatex failing in GitHub Actions:

(lyluatex)	Compiling score tmp-ly/7140c4bbdb90291190558426f58d61bd with LilyPond executable 'lilypond'.
fatal error: cannot rename `7140c4bbdb90291190558426f58d61bd.eps.356991.pdf' to `7140c4bbdb90291190558426f58d61bd.pdf'
Module lyluatex Warning: The score doesn't contain any music:
(lyluatex)               this will probably cause bad output. on input line 13
...ocal/texlive/2022/texmf-dist/tex/latex/base/ltluatex.lua:110: 
Module lyluatex Error: 
(lyluatex)             LilyPond failed to compile the score.
(lyluatex)             Please check the log file
(lyluatex)             and the generated LilyPond code in
(lyluatex)             tmp-ly/7140c4bbdb90291190558426f58d61bd.log
(lyluatex)             tmp-ly/7140c4bbdb90291190558426f58d61bd.ly
(lyluatex)             
(lyluatex)             on input line 13

I have been using GitHub Actions to typeset LaTeX documents for several years now and I have never encountered an error like this. Do you have any idea what the issue could be? I struggle to reproduce the issue outside of GitHub Actions.

Witiko avatar Oct 12 '22 23:10 Witiko

A bit short on time now, and I don’t master github actions well. I should be able to look at this within next month.

jperon avatar Oct 13 '22 08:10 jperon

The fatal error seems related to the conversion from ESP to PDF, which is not even done by lyluatex, correct? It should be done by Hagen's conversion script when we feed an EPS image to the \pdfximage primitive of pdfTeX.

Witiko avatar Oct 16 '22 15:10 Witiko

I really don’t understand what’s wrong with this. I’ve tried to compile the example within a local texlive/texlive controller, and it runs like a charm. @Witiko if you know github actions well, would you have a mean to get a remote shell on it, in order to debug more easily ?

jperon avatar Oct 31 '22 15:10 jperon

@jperon I am not sure that is possible, although I am far from an expert.

Witiko avatar Oct 31 '22 16:10 Witiko

I could get my hands on it thanks to https://gist.github.com/lava/62a6697abcaf6e5709939ae29e7bd4be.

The problem originates from the lilypond command (launched by lyluatex), which returns:

warning: g_spawn_sync failed (0): gs: Failed to close file descriptor for child process (Operation not permitted)

At first glance, it seems the problem comes from restrictions in the containers spawned by Github. @Witiko Would you mind trying to create a MWE using only lilypond (without LuaLaTeX), to see wether the issue arises ? If so, this bug would have to be signaled upstream.

jperon avatar Oct 31 '22 17:10 jperon

@jperon Are you certain that the issue is with lilypond? The output seems to suggest that the issue might be with the gs command that we also execute in bbox_parse() and in Score:optimize_pdf().

Witiko avatar Oct 31 '22 20:10 Witiko

In the MWE, optimize-pdf is not set. In any case, I did get this error by manually launching lilypond tmp-ly/TMPDOC.ly….

jperon avatar Oct 31 '22 22:10 jperon

Thanks, I will see if I can get to try this sometime this week.

Witiko avatar Nov 01 '22 07:11 Witiko

@jperon I added complilation with Lilypond to witiko/lyluatex-github-actions-example@03bdbf3. As you correctly predicted in https://github.com/jperon/lyluatex/issues/295#issuecomment-1297463345, compilation with Lilypond is also failing on GitHub Actions. Therefore, this seems to be an upstream issue.

Before reporting the issue upstream, I would remove the Lyluatex code and try if the issue persists without the texlive/texlive:latest Docker image, so that our MWE is truly minimal.

Witiko avatar Nov 07 '22 12:11 Witiko

Before reporting the issue upstream, I would remove the Lyluatex code and try if the issue persists without the texlive/texlive:latest Docker image, so that our MWE is truly minimal.

Good point; if it works with default Github actions, I think it would still be worth reporting upstream, but narrowing the subject to "LilyPond fails to compile documents in GitHub Actions within default texlive image", mentionning especially those lines:

warning: g_spawn_sync failed (0): gs: Failed to close file descriptor for child process (Operation not permitted)
fatal error: cannot rename `document-tmp-7187241.502287.pdf' to `document.pdf'

jperon avatar Nov 07 '22 14:11 jperon

I reported the issue upstream.

Witiko avatar Nov 07 '22 16:11 Witiko