4

(This is a follow up of How to make latexmk ignore certain input files as dependencies, and Avoid latexmk rerun forced by new timestamp of lualatex cache where @JohnCollins asked for the work flow that reproduces the problem.)

Below is a stand-alone example, whose compilation by latexmk never terminates for a reason of this type:

Rule 'lualatex':  Reasons for rerun
Changed files or newly in use/created:
  ⟨auxiliary file 2⟩.pdf
  ⟨auxiliary file 1⟩.pdf
Category 'changed_user':
  ⟨auxiliary file 2⟩.pdf
  ⟨auxiliary file 1⟩.pdf

As you can see, this example isn't as minimal as one might hope, but I couldn't make it any shorter. In particular, it only highlights the problem encountered under the following (bizarre) conditions for the two auxiliary files concerned:

  • created in a sub-directory,
  • (very) long file names,
  • both involving the FreeSerif font,
  • with resulting PDFs included in the main file.

Like one of the OPs above, the following code in latexmkrc does not prevent latexmk from rerunning:

$hash_calc_ignore_pattern{'luc'}='^';

Warning! The example below must be compiled with the shell-escape flag, with the following command:

latexmk -norc -r test-latexmkrc.tex --shell-escape -pdflua test-latexmk.tex

Now the example:

\begin{filecontents*}[overwrite]{test-latexmkrc}
$hash_calc_ignore_pattern{'luc'}='^';
\end{filecontents*}

\documentclass{article}
\usepackage{graphicx}
\usepackage{shellesc}

\ShellEscape{[ -d codedir ] || mkdir codedir}

\begin{document}

\begin{filecontents*}[overwrite]{codedir/fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo}
\documentclass{article}
\usepackage{fontspec}
\usepackage{newunicodechar}

\newfontface\myfontface{FreeSerif}
\newunicodechar{❶}{{\myfontface ❶}}

\begin{document}\pagestyle{empty}
❶
\end{document}
\end{filecontents*}
\ShellEscape{cd codedir && latexmk -lualatex fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo}
\ShellEscape{[ codedir/fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo.pdf -nt codedir/fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo-crop.pdf ] && cd codedir && pdfcrop fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo}

\includegraphics{codedir/fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo-crop.pdf}

\begin{filecontents*}[overwrite]{codedir/baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar}
\documentclass{article}
\usepackage{fontspec}
\pagestyle{empty}

\begin{document}\pagestyle{empty}
\fontspec{FreeSerif.otf}
\Large ^^^^20a3
\end{document}
\end{filecontents*}
\ShellEscape{cd codedir && latexmk -lualatex baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar}
\ShellEscape{[ codedir/baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar.pdf -nt codedir/baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar-crop.pdf ] && cd codedir && pdfcrop baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar}

\includegraphics{codedir/baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar-crop.pdf}
\end{document}

As asked by @JohnCollins, here is the content of the .fdb_latexmk file of the main (test-latexmk) file:

# Fdb version 4
  ["lualatex"] 1716985499.78893 "test-latexmk.tex" "test-latexmk.pdf" "test-latexmk" 1716985526.46208 0
    "/usr/local/texlive/2024/texmf-dist/fonts/opentype/public/lm/lmroman10-regular.otf" 1255129361 111536 ae9d1b331000d544f47e5223081b7b54 ""
    "/usr/local/texlive/2024/texmf-dist/tex/context/base/mkii/supp-pdf.mkii" 1461363279 71627 94eb9990bed73c364d7f53f960cc8c5b ""
    "/usr/local/texlive/2024/texmf-dist/tex/generic/pdftexcmds/pdftexcmds.lua" 1593380077 9447 5e9f52f1871707a5d27dea360afbe4cb ""
    "/usr/local/texlive/2024/texmf-dist/tex/latex/base/article.cls" 1705352648 20144 147463a6a579f4597269ef9565205cfe ""
    "/usr/local/texlive/2024/texmf-dist/tex/latex/base/ltluatex.lua" 1705352648 24543 44e225ecc61706b060f0189a96e1cc1d ""
    "/usr/local/texlive/2024/texmf-dist/tex/latex/base/size10.clo" 1705352648 8448 dbc0dbf4156c0bb9ba01a1c685d3bad0 ""
    "/usr/local/texlive/2024/texmf-dist/tex/latex/base/ts1cmr.fd" 1705352648 2430 fce77d7e103eb98b6c4d486ae1d466c0 ""
    "/usr/local/texlive/2024/texmf-dist/tex/latex/epstopdf-pkg/epstopdf-base.sty" 1579991033 13886 d1306dcf79a944f6988e688c1785f9ce ""
    "/usr/local/texlive/2024/texmf-dist/tex/latex/graphics-cfg/graphics.cfg" 1465944070 1224 978390e9c2234eab29404bc21b268d1e ""
    "/usr/local/texlive/2024/texmf-dist/tex/latex/graphics-def/luatex.def" 1713382759 19452 a728bcaeeefa51a7c3306ca022b2b1fc ""
    "/usr/local/texlive/2024/texmf-dist/tex/latex/graphics/graphics.sty" 1654720880 18387 8f900a490197ebaf93c02ae9476d4b09 ""
    "/usr/local/texlive/2024/texmf-dist/tex/latex/graphics/graphicx.sty" 1654720880 8010 a8d949cbdbc5c983593827c9eec252e1 ""
    "/usr/local/texlive/2024/texmf-dist/tex/latex/graphics/keyval.sty" 1654720880 2671 7e67d78d9b88c845599a85b2d41f2e39 ""
    "/usr/local/texlive/2024/texmf-dist/tex/latex/graphics/trig.sty" 1654720880 4023 293ea1c16429fc0c4cf605f4da1791a9 ""
    "/usr/local/texlive/2024/texmf-dist/tex/latex/l3backend/l3backend-luatex.def" 1716410060 30206 5deb92e8e3cf7df2d55bef81d3986b22 ""
    "/usr/local/texlive/2024/texmf-dist/tex/latex/l3backend/l3backend-luatex.lua" 1704491087 3839 b2e3045c3d6386724a7a4977b109956f ""
    "/usr/local/texlive/2024/texmf-dist/tex/latex/l3kernel/expl3.lua" 1714507389 18205 decd3ac61ad4bcc14cda182cb5c0e7b7 ""
    "/usr/local/texlive/2024/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg" 1279039959 678 4792914a8f45be57bb98413425e4c7af ""
    "/usr/local/texlive/2024/texmf-dist/tex/latex/tex-ini-files/lualatexquotejobname.lua" 1700513690 1021 ae37ae5e20605f170274bb33ea1a0e3d ""
    "/usr/local/texlive/2024/texmf-dist/tex/latex/tools/shellesc.sty" 1698869629 4121 f96144e646260251ded7f19bcb6f4e71 ""
    "/usr/local/texlive/2024/texmf-dist/tex/luatex/lua-uni-algos/lua-uni-case.lua" 1645915452 1921 020c660fdc1d4c83ffebb059fead7b51 ""
    "/usr/local/texlive/2024/texmf-dist/tex/luatex/lua-uni-algos/lua-uni-normalize.lua" 1645915452 21269 eb4154856f0afe9e8d886dbf6922dcc6 ""
    "/usr/local/texlive/2024/texmf-dist/tex/luatex/lua-uni-algos/lua-uni-parse.lua" 1645915452 2115 596f0e8384e97c26c78a8e88c65a7843 ""
    "/usr/local/texlive/2024/texmf-dist/tex/luatex/lualibs/lualibs-basic-merged.lua" 1692561251 131460 7015f38db4e78c4821318144c6980394 ""
    "/usr/local/texlive/2024/texmf-dist/tex/luatex/lualibs/lualibs-basic.lua" 1692561251 2685 2fd4fa3426f4dda85135669993283e9b ""
    "/usr/local/texlive/2024/texmf-dist/tex/luatex/lualibs/lualibs-compat.lua" 1367794330 603 398583cb619d20952d67edcedae41608 ""
    "/usr/local/texlive/2024/texmf-dist/tex/luatex/lualibs/lualibs-extended-merged.lua" 1692561251 140360 1ec312f1a70c43b37e53af03b4bd7323 ""
    "/usr/local/texlive/2024/texmf-dist/tex/luatex/lualibs/lualibs-extended.lua" 1692561251 5000 964f0ac2a95b6856d92913f68e0689a7 ""
    "/usr/local/texlive/2024/texmf-dist/tex/luatex/lualibs/lualibs.lua" 1692561251 3780 3cfe6b013a0ab68c61b751da491afaac ""
    "/usr/local/texlive/2024/texmf-dist/tex/luatex/luaotfload/fontloader-2023-12-28.lua" 1708117833 885747 f33a8946b4d6a005e76276706db83059 ""
    "/usr/local/texlive/2024/texmf-dist/tex/luatex/luaotfload/fontloader-basics-gen.lua" 1709155629 12788 578c251c496bed783075709e94c2be26 ""
    "/usr/local/texlive/2024/texmf-dist/tex/luatex/luaotfload/luaotfload-arabic.lua" 1709155629 5364 49a6ddd634bdb37bacb08c17d1550f50 ""
    "/usr/local/texlive/2024/texmf-dist/tex/luatex/luaotfload/luaotfload-auxiliary.lua" 1709155629 34239 6dbe1a2a3f36cf57845e54c1927ccfee ""
    "/usr/local/texlive/2024/texmf-dist/tex/luatex/luaotfload/luaotfload-bcp47.lua" 1664913378 3674 ad13e5d6b82aff53a36384fd239c5d6c ""
    "/usr/local/texlive/2024/texmf-dist/tex/luatex/luaotfload/luaotfload-case.lua" 1664913378 16116 3d55feb55802d40830807a7459cb345a ""
    "/usr/local/texlive/2024/texmf-dist/tex/luatex/luaotfload/luaotfload-colors.lua" 1709155629 18372 cda35651d19ec5ae24d18f3b0e1cfeec ""
    "/usr/local/texlive/2024/texmf-dist/tex/luatex/luaotfload/luaotfload-configuration.lua" 1709155629 34054 0abab568ba9c0082c9ad3e1b75897d49 ""
    "/usr/local/texlive/2024/texmf-dist/tex/luatex/luaotfload/luaotfload-database.lua" 1709155629 135377 0e2f26fead21ffdb36f36a5090220f8d ""
    "/usr/local/texlive/2024/texmf-dist/tex/luatex/luaotfload/luaotfload-embolden.lua" 1709155629 1004 6b15c8ae9e49cfb4a5e319aadf1ef3ac ""
    "/usr/local/texlive/2024/texmf-dist/tex/luatex/luaotfload/luaotfload-fallback.lua" 1709155629 4047 3b1569703b22fabe9661f2188fa0dbd3 ""
    "/usr/local/texlive/2024/texmf-dist/tex/luatex/luaotfload/luaotfload-features.lua" 1709155629 35386 756bc857a0d63bf1a6abbd1406e85844 ""
    "/usr/local/texlive/2024/texmf-dist/tex/luatex/luaotfload/luaotfload-harf-define.lua" 1709155629 19482 f1319af7f3837fbda6db470b77627c71 ""
    "/usr/local/texlive/2024/texmf-dist/tex/luatex/luaotfload/luaotfload-harf-plug.lua" 1709155629 42681 201bbdd109fa1f0b02068e59f2f5384d ""
    "/usr/local/texlive/2024/texmf-dist/tex/luatex/luaotfload/luaotfload-harf-var-cff2.lua" 1709155629 14126 969cfafc9b19f07aa3e945dd2d3bd6ca ""
    "/usr/local/texlive/2024/texmf-dist/tex/luatex/luaotfload/luaotfload-harf-var-t2-writer.lua" 1709155629 4050 f57f854058ea50d565be9558f3ee2647 ""
    "/usr/local/texlive/2024/texmf-dist/tex/luatex/luaotfload/luaotfload-harf-var-ttf.lua" 1709155629 20523 f40bb0362e93dec1cb185536de4be47d ""
    "/usr/local/texlive/2024/texmf-dist/tex/luatex/luaotfload/luaotfload-init.lua" 1709155629 19746 5808f9c69b6a266fef8b923aefaecdc3 ""
    "/usr/local/texlive/2024/texmf-dist/tex/luatex/luaotfload/luaotfload-letterspace.lua" 1709155629 20268 45fe7d691be75f6ef7f0c058c40113d9 ""
    "/usr/local/texlive/2024/texmf-dist/tex/luatex/luaotfload/luaotfload-loaders.lua" 1709155629 10733 80907f5cf87e2d5f946936a1ef08b6a8 ""
    "/usr/local/texlive/2024/texmf-dist/tex/luatex/luaotfload/luaotfload-log.lua" 1709155629 11323 b0cd5d77653fae19eceb1c1f195d9b77 ""
    "/usr/local/texlive/2024/texmf-dist/tex/luatex/luaotfload/luaotfload-main.lua" 1609451516 275 b19c9cc34cf1d676c39f872cfb41aef6 ""
    "/usr/local/texlive/2024/texmf-dist/tex/luatex/luaotfload/luaotfload-multiscript.lua" 1709155629 15068 1415dc53c2ad56f6dc892212090d7c03 ""
    "/usr/local/texlive/2024/texmf-dist/tex/luatex/luaotfload/luaotfload-notdef.lua" 1709155629 12258 920854a37e695604457cb1fcad35a814 ""
    "/usr/local/texlive/2024/texmf-dist/tex/luatex/luaotfload/luaotfload-parsers.lua" 1709155629 30436 73f67f95af947fe741c931e6f60b84cb ""
    "/usr/local/texlive/2024/texmf-dist/tex/luatex/luaotfload/luaotfload-realpath.lua" 1709155629 4692 f3b5a8bf6d49e81bc8637547ad67334d ""
    "/usr/local/texlive/2024/texmf-dist/tex/luatex/luaotfload/luaotfload-resolvers.lua" 1709155629 11209 0f87b7c297120189ddbd31f6ee324a9f ""
    "/usr/local/texlive/2024/texmf-dist/tex/luatex/luaotfload/luaotfload-scripts.lua" 1709155629 2506 2026f40b86c3e93eba401524424e71d9 ""
    "/usr/local/texlive/2024/texmf-dist/tex/luatex/luaotfload/luaotfload-status.lua" 1709155629 6317 d7e4e397c1c9279d55136ae8a79c077e ""
    "/usr/local/texlive/2024/texmf-dist/tex/luatex/luaotfload/luaotfload-suppress.lua" 1709155629 2582 1cbd162cbdc589adec03aa82e2ba0048 ""
    "/usr/local/texlive/2024/texmf-dist/tex/luatex/luaotfload/luaotfload-szss.lua" 1709155629 6309 bdf184e24947478dc89307adf866a3ca ""
    "/usr/local/texlive/2024/texmf-dist/tex/luatex/luaotfload/luaotfload-tounicode.lua" 1709155629 7528 245271ce518c136c96f22fee6cb810ab ""
    "/usr/local/texlive/2024/texmf-dist/tex/luatex/luaotfload/luaotfload-unicode.lua" 1709155629 7917 cebc6454abe34f2fe1c1248f8b2453da ""
    "/usr/local/texlive/2024/texmf-dist/tex/luatex/luaotfload/luaotfload.lua" 1709155629 13565 50482dad4c221a79dbdbb982122baf8c ""
    "/usr/local/texlive/2024/texmf-var/fonts/map/pdftex/updmap/pdftex.map" 1716958469 5483668 9e45798515b35c9eab0413928a3e8881 ""
    "/usr/local/texlive/2024/texmf-var/luatex-cache/generic/fonts/otl/lmroman10-regular.luc" 1710409269.09386 127327 d41d8cd98f00b204e9800998ecf8427e ""
    "/usr/local/texlive/2024/texmf-var/web2c/luahbtex/lualatex.fmt" 1716878509 12270116 5fbfe8f1ae191cbcc5f2e3e8850d6937 ""
    "codedir/baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar-crop.pdf" 1716985499.53753 2972 88b82af6cc62c57e20b431f7489824e5 ""
    "codedir/baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar.tex" 1716985512.59765 155 16c63d006689538addcda2fefad7a8db "lualatex"
    "codedir/fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo-crop.pdf" 1716985487.92743 11092 56629149920b0edafc306245ef678af6 ""
    "codedir/fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo.tex" 1716985501.56555 204 0e3ff986803de3d139b2b034e563e91e "lualatex"
    "test-latexmk.aux" 1716985526.31377 32 3985256e7290058c681f74d7a3565a19 "lualatex"
    "test-latexmk.tex" 1716985397.13961 1836 81ee0d6f06ea95b24e512b5577b62910 ""
    "test-latexmkrc.tex" 1716985501.16455 38 90add2bf98861bef2cc09692900a1e89 "lualatex"
    (generated)
    "codedir/baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar.tex"
    "codedir/fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo.tex"
    "test-latexmk.aux"
    "test-latexmk.log"
    "test-latexmk.pdf"
    "test-latexmkrc.tex"
    (rewritten before read)

Edit

Here is the end of the lualatex run where information on included font files is (not really?) given:

(./test-latexmk.aux))
 406 words of node memory still in use:
   3 hlist, 1 vlist, 1 rule, 2 glue, 3 kern, 1 glyph, 4 attribute, 48 glue_spec
, 4 attribute_list, 1 write nodes
   avail lists: 1:1,2:48,3:6,4:1,5:24,6:4,7:48,9:56
</usr/local/texlive/2024/texmf-dist/fonts/opentype/public/lm/lmroman10-regular.
otf>
Output written on test-latexmk.pdf (1 page, 15212 bytes).
Transcript written on test-latexmk.log.
Latexmk: Getting log file 'test-latexmk.log'
Latexmk: Examining 'test-latexmk.fls'
Latexmk: Examining 'test-latexmk.log'
Latexmk: Log file says output to 'test-latexmk.pdf'
Latexmk: applying rule 'lualatex'...
Rule 'lualatex':  Reasons for rerun
Changed files or newly in use/created:
  codedir/baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar-crop.pdf
  codedir/fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo-crop.pdf
Category 'changed_user':
  codedir/baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar-crop.pdf
  codedir/fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo-crop.pdf

Latexmk: All targets (test-latexmk.pdf) are up-to-date
Latexmk: Maximum runs of lualatex reached without getting stable files
----------------------
This message may duplicate earlier message.

Latexmk: Failure in processing file 'test-latexmk.tex':
   'lualatex' needed too many passes
----------------------
Latexmk: Sometimes, the -f option can be used to get latexmk
  to try to force complete processing.
  But normally, you will need to correct the file(s) that caused the
  error, and then rerun latexmk.
  In some cases, it is best to clean out generated files before rerunning
  latexmk after you've corrected the files.

BTW, a friend of mine doesn't have this problem on macOS with a TL 2024.

5
  • 1
    @user691586 End of the lualatex run where information on included font files is given added. test-latexmkrc.tex added (the .tex comes from it is generated from filecontents*: it doesn't hurt). No problem with only one externalized document. Commented May 29, 2024 at 15:50
  • I think we need the complete logs of the lualatex runs on the 2 extracted files Commented May 29, 2024 at 21:15
  • 1
    The first ShellEscape is lacking cd codedir && . With it, on my system, (also mac os as your friend), compilation has no problem. But you probably intended to include cd codedir && . I am wondering if you have both .otf and .ttf versions of FreeSerif. Maybe first file uses ttf, second is set to use otf. You did not show the logs from the subruns in codedir. Commented May 29, 2024 at 21:20
  • 1
    on my system both files uses the same </usr/local/texlive/2024/texmf-dist/fonts/opentype/public/gnu-freefont/FreeSerif.otf> according to their logs; is this the case on your system? (logs in codedir) Commented May 29, 2024 at 21:25
  • @user691586 Sorry for the lacking lacking cd codedir && , now added. Indeed, the first file uses /usr/share/fonts/mscore/FreeSerif.ttf and the second one /usr/local/texlive/2024/texmf-dist/fonts/opentype/public/gnu-freefont/FreeSerif.otf. By forcing the extension in the first one (\newfontface\myfontface{FreeSerif.otf} instead of \newfontface\myfontface{FreeSerif}), the problem is solved! If you make your very helpful comments an answer, I would gladly accept it. Commented May 30, 2024 at 7:16

1 Answer 1

2

(from comments)

It seems that

/usr/local/texlive/2024/texmf-var/luatex-cache/generic/fonts/otl/freeserif.lua
/usr/local/texlive/2024/texmf-var/luatex-cache/generic/fonts/otl/freeserif.luc

are redone if you compile with lualatex documents which are using in alternance FreeSerif.otf (document A) and FreeSerif.ttf (document B).

In your example this causes extracted documents to be systematically rebuilt by the latexmk, and then as the PDFs are new, pdfcrop is invoked, causing the -crop.pdf's to be redone which triggers the main latexmk -lualatex on the global document to always launch a new round until it reaches the maximum allowed number of runs.

6
  • In your opinion, is the fact that freeserif.{lua;luc} are redone a bug or a feature? And, in the former case, do you know where it should be reported? Commented May 30, 2024 at 13:11
  • 1
    it looks as if there would be no problem if the .lua and .luc basenames were freeserifotf and freeserifttf. Not being competent enough I can't have any serious opinion on why this is not the case. Commented May 30, 2024 at 21:19
  • 1
    as to where it should be reported, perhaps at luaotfload dev site Commented May 30, 2024 at 21:25
  • I guess freeserifotf and freeserifttf won't be enough since I stumbled upon “Changed files or newly in use/created: /usr/local/texlive/2024/texmf-var/luatex-cache/generic/fonts/otl/kpsans-bolditalic.luc Category 'changed_user': /usr/local/texlive/2024/texmf-var/luatex-cache/generic/fonts/otl/kpsans-bolditalic.luc Commented May 31, 2024 at 21:06
  • and you have both otf and ttf for kpfonts? Commented Jun 1, 2024 at 19:09

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.