jperon / lyluatex

Alternative à lilypond-book pour lualatex
MIT License
58 stars 12 forks source link

Lyluatex fails to compile documents in GitHub Actions #295

Closed Witiko closed 2 years ago

Witiko commented 2 years ago

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.

jperon commented 2 years ago

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.

Witiko commented 2 years ago

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.

jperon commented 2 years ago

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 ?

Witiko commented 2 years ago

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

jperon commented 2 years ago

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.

Witiko commented 2 years ago

@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().

jperon commented 2 years ago

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

Witiko commented 2 years ago

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

Witiko commented 2 years ago

@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.

jperon commented 2 years ago

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'
Witiko commented 2 years ago

I reported the issue upstream.

Witiko commented 2 years ago

At the Lilypond GitLab repository, I was told to go to the lilypond-user mailing list, which I did.