Shell escape restricted by default in TeX Live 2022
0 reputation · 15 Dec 2022, 10:19 UTC
0 reputation · 15 Dec 2022, 10:19 UTC
TeX Live 2022 changed the default engine invocation so that pdftex, xetex, and luatex run with shell escape disabled unless explicitly enabled. Documents using \write18 to call external programs can compile without an error while producing incomplete output after an upgrade from TeX Live 2021 or earlier. The maintainers have not committed to restoring the permissive default in future releases.
The goal is to decide whether shared templates should enable shell escape globally, per document, or remove \write18 dependence entirely. Re-enabling the feature through environment variables or wrapper scripts reintroduces arbitrary code execution risks, particularly for untrusted sources, and the engine does not signal the restriction as a failure.
Specific questions:
Do not enable shell escape globally for shared templates. Assume restricted mode is permanent and treat shell escape as an opt-in, per-invocation capability for trusted builds only. There is no stable per-project TeX configuration that enables shell escape without changing the engine invocation.
After upgrading from TeX Live 2021 or earlier, documents that relied on \write18 now compile without error but produce incomplete output because the external commands are no longer executed.
Enforcement in a shared build environment is done outside TeX:
pdflatex --versionCreate test.tex with \write18{touch shell_test.txt} and run pdflatex test.tex. If shell_test.txt is not created, restriction is active. Run pdflatex --shell-escape test.tex to confirm the flag restores functionality.
Missing diagnostic that changes recommendation: Are these templates compiled in a multi-tenant environment where users can upload their own .tex files, or is the source controlled by a central authority?
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.