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

Failing to correctly recover LaTeX packages #57

Closed
tueda opened this issue Oct 10, 2022 · 15 comments
Closed

Failing to correctly recover LaTeX packages #57

tueda opened this issue Oct 10, 2022 · 15 comments
Assignees

Comments

@tueda
Copy link

tueda commented Oct 10, 2022

I tried to use this action to cache LaTeX packages:

      - uses: awalsh128/[email protected]
        with:
          packages: texlive-latex-base  # and other LaTeX packages
          version: 1.0

An example repository is here. Storing cache (~61M) seems to work (log), but in the next commit, restoring the cache causes the subsequent step to fail (log):

Run pdflatex test.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/Debian) (preloaded format=pdflatex)
 restricted \write18 enabled.

kpathsea: Running mktexfmt pdflatex.fmt
mktexfmt: mktexfmt is using the following fmtutil.cnf files (in precedence order):
mktexfmt: mktexfmt is using the following fmtutil.cnf file for writing changes:
mktexfmt:   /home/runner/.texlive2019/texmf-config/web2c/fmtutil.cnf
mktexfmt [INFO]: writing formats under /home/runner/.texlive2019/texmf-var/web2c
mktexfmt [INFO]: did not find entry for byfmt=pdflatex, skipped
mktexfmt [INFO]: total formats: 0
mktexfmt [INFO]: exiting with status 0
I can't find the format file `pdflatex.fmt'!
Error: Process completed with exit code 1.

which sounds like some post-install processes might be omitted or performed in an incompatible way.

@awalsh128
Copy link
Owner

One way we can see if the file is there statically is to look inside the package itself. Can you run this for me?

dpkg -c package_file.deb

You can also use the -e switch to extract the postinst.sh script. One of them should reveal the file. Otherwise it may be an artifact generated deeper down in the post install.

@tueda
Copy link
Author

tueda commented Oct 12, 2022

Thank you for your reply! I put

dpkg -c /var/cache/apt/archives/texlive-base_2019.20200218-1_all.deb

and

dpkg -e /var/cache/apt/archives/texlive-base_2019.20200218-1_all.deb
head -n 100000 DEBIAN/*

in the workflow (log).

I noticed that, for the successful case (without restoring cache, see the above log)

kpsewhich fmtutil.cnf
kpsewhich -engine=pdftex pdflatex.fmt 

print

/usr/share/texmf/web2c/fmtutil.cnf
/var/lib/texmf/web2c/pdftex/pdflatex.fmt

but restoring apt packages from the cache causes them to print nothing (log), though /usr/share/texmf/web2c/fmtutil.cnf -> /var/lib/texmf/fmtutil.cnf-DEBIAN exists.

@awalsh128
Copy link
Owner

Added a regression test for this and confirmed it fails on the CI as well (test result log). When I run the action locally (action_local.sh), the command prints a result which seems to indicate an artifact still gets left around even after an APT purge and autoremove.

I'll update the ticket once I have more.

@tueda
Copy link
Author

tueda commented Nov 4, 2022

Maybe a similar issue for MPI:

      - uses: awalsh128/[email protected]
        with:
          packages: libmpich-dev
          version: 1.0

@BoboTiG
Copy link
Contributor

BoboTiG commented Nov 15, 2022

Gentle ping to notice we also have the LaTeX issue. Do you need more data to move forward?

Using that code:

      - uses: awalsh128/cache-apt-pkgs-action@latest
        with:
          packages: dvipng texlive-latex-extra texlive-fonts-extra texlive-science dictzip
          version: 1.0

@awalsh128
Copy link
Owner

awalsh128 commented Nov 16, 2022

Hi @BoboTiG , sorry for the lag here. Replicating the issue for yourself as noted above in comment would be helpful.

Really the main thing is what in that APT package is being omitted when it is backed up. That is what I am trying to find to see if we can modify this action to accommodate. I am thinking this is very similar to #44 (comment)

@awalsh128
Copy link
Owner

@BoboTiG thanks for your help with the other ticket. I'll be able to dig more into this issue this weekend and will do a patch release with your most recent commit.

@awalsh128
Copy link
Owner

awalsh128 commented Nov 20, 2022

I was able to debug some of the install script behavior to work correctly in general but the regression is still failing. The execute script feature is in dev. You can run this if you want but I am not seeing any scripts to execute yet.

uses: awalsh128/cache-apt-pkgs-action@dev
with:
    packages: yourpackage
    version: 1
    execute_install_scripts: true

WARNING: The outputs are broken on the action. This shouldn't matter though if you don't use them.

I'll update the ticket once I fix some other breaks and can get around to debugging this with the new feature.

@awalsh128
Copy link
Owner

I may be possibly hitting the reaches of what the action can do. The texlive-latex-base.postinst script requires that it is called within a maintainer script (see https://www.debian.org/doc/debian-policy/ap-flowcharts.html).

awalsh128@lithium:~/cache-apt-pkgs-action-ci/devtools$ sh -x /tmp/texlive-latex-base.postinst configure
+ set -e
+ update-texmf-config format map
dpkg-trigger: error: must be called from a maintainer script (or with a --by-package option)

Type dpkg-trigger --help for help about this utility.

The execute_install_scripts feature really only works for simple shell scripts that aren't dependent on the Debian package manager commands. To be able to execute this postinst script I would need to run sudo dpkg --configure texlive-latex-base. Although this requires that the package be registered in the package manager database. You see how this can be quite the rabbit hole.

I am going to let the feature stay but I think I have hit the limits of what this action can do. Open to ideas but without anything new I think I may just mark this as "won't fix". 😞

@BoboTiG
Copy link
Contributor

BoboTiG commented Nov 20, 2022

No worries, it is already great to have such an action :)

@awalsh128
Copy link
Owner

Published the latest version of the action. Going to close this out.

https://github.com/awalsh128/cache-apt-pkgs-action/releases/tag/v1.2.0

@awalsh128 awalsh128 closed this as not planned Won't fix, can't repro, duplicate, stale Nov 24, 2022
nicomen added a commit to gamle-oslo-venstre/program that referenced this issue Feb 10, 2023
@asmeurer
Copy link

If anyone ever figures out the solution to the I can't find the format file pdflatex.fmt'!` problem when using this action with texlive please share. Reinstalling latex in each build is a huge pain.

@asmeurer
Copy link

I guess the solution is to use a docker image. I was able to use https://github.com/xu-cheng/latex-docker, but in general you might have to build your own docker image with the packages you need.

@koppor
Copy link
Contributor

koppor commented Aug 23, 2023

One can use the action https://github.com/zauguin/install-texlive, which also supports caching and uses way less disk space.

@koppor
Copy link
Contributor

koppor commented Jan 11, 2024

@asmeurer A well-maintained docker image is https://gitlab.com/islandoftex/images/texlive. It is originating a team very close to overleaf and latex development in general.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants