Subject: bug#64772: TeXlive (specifically LuaLaTeX) has become terribly slow

From: Wojtek Kosior <[email-masked]>
Date: Thu, 27 Jul 2023 00:21:42 +0200

Hi,

I think I know what causes a subdirectory of '{' to be used for caches
— the 'share/texmf-dist/web2c/texmf.cnf' file in the
texlive-libkpathsea package has a

    TEXMFROOT = {$GUIX_TEXMF}/..

line. It's a "runtime path configuration file for kpathsea" and in
general it supports brace expansion. However, in this case something
goes wrong. Maybe the expansion is only triggered when there's at least
one comma in between the braces? Idk. Btw, Guix uses ":" and not a
comma as path separator in 'GUIX_TEXMF' variable and I have no idea
whether kpathsea's brace expansion allows ":" to be used instead of ",".

Still, I'm pretty sure it is this line that causes the '{' directory
problem — I tried running lualatex after bind-mounting a modified
texmf.cnf over the one in the store. I replaced that line with

    TEXMFROOT = $GUIX_TEXMF/..

and no '{' was created this time. Of course, it only worked because
GUIX_TEXMF was holding just one path — a general solution would need to
be different. Just in case, this is the part of texlive-kpathsea
definition in gnu/packages/tex.scm that prepares 'texmf.cnf':

```
          (add-after 'unpack 'customize-texmf.cnf
            ;; The default "texmf.cnf" file is provided by this package.
            ;; Every variable of interest is set relatively to the GUIX_TEXMF
            ;; environment variable defined via a search path below.
            ;;
            ;; This phase must happen before the `configure' phase, because
            ;; the value of the TEXMFCNF variable (modified along with the
            ;; SELFAUTOLOC reference below) is used at compile time to
            ;; generate "paths.h" file.
            (lambda _
              (substitute* "texk/kpathsea/texmf.cnf"
                (("^TEXMFROOT = .*")
                 "TEXMFROOT = {$GUIX_TEXMF}/..\n")
                (("^TEXMF = .*")
                 "TEXMF = {$GUIX_TEXMF}\n")
                (("\\$SELFAUTOLOC(/share/texmf-dist/web2c)" _ suffix)
                 (string-append #$output suffix))
                ;; Don't truncate lines.
                (("^error_line = .*$") "error_line = 254\n")
                (("^half_error_line = .*$") "half_error_line = 238\n")
                (("^max_print_line = .*$") "max_print_line = 1000\n"))))

```

Unfortunately, changes to 'texmf.cnf' don't affect the running time of
lualatex — it's still terribly slow

Wojtek

-- (sig_start)
website: https://koszko.org/koszko.html
fingerprint: E972 7060 E3C5 637C 8A4F  4B42 4BC5 221C 5A79 FD1A
follow me on Fediverse: https://friendica.me/profile/koszko/profile

♥ R29kIGlzIHRoZXJlIGFuZCBsb3ZlcyBtZQ== | ÷ c2luIHNlcGFyYXRlZCBtZSBmcm9tIEhpbQ==
✝ YnV0IEplc3VzIGRpZWQgdG8gc2F2ZSBtZQ== | ? U2hhbGwgSSBiZWNvbWUgSGlzIGZyaWVuZD8=
-- (sig_end)