Bug in calls to perl scripts from Windows executables in TeXLive 2023?
John Collins
jcc8 at psu.edu
Thu Jul 20 23:38:40 CEST 2023
The following was brought to my attention by a user as an apparent bug in the
version of latexmk provided by TeXLive 2023 on Windows. Further investigation
showed that the problem is not with latexmk itself, but appears when one runs
one of the Windows executables, like latexmk.exe, pdfcrop.exe, etc, that runs a
corresponding perl script.
First, there is no problem when the Perl interpreter that gets used is the one
bundled with TL 2023 on Windows, or the Strawberry Perl version.
But a problem does appear when MSYS2 is installed, and PATH is set to contains
its bin directory, so that TeXLive uses MSYS2's perl interpreter. It occurs
when one of the command line arguments contains a space character and a
non-ASCII character, e.g., when giving the commands like
latexmk "-outdir=special ä" test.tex
pdfcrop "test ä.pdf"
Then the arguments received by the Perl script in each case contain the double
quote characters. For example, pdfcrop thinks it is asked to use a file named
'"test ä.pdf"' instead of 'test ä.pdf'. This naturally produces various kinds
of strange error, whose actual cause is not immediately clear.
When the PATH is such that one of the other Perls is used (TeXLive's own or
Strawberry Perl), the double quotes are removed by the time the script sees
them. Also the quotes are removed if I explicitly invoke perl on the script,
e.g.,
perl c:\texlive\2023\texmf-dist\scripts\latexmk\latexmk.pl "-outdir=special
ä" test.tex
So the problem appears specific to how latexmk.exe, pdfcrop.exe, etc invoke
Perl scripts.
Steps to reproduce the problem:
1. Current TeXLive 2023 on Windows installed in its default location.
2. Install MSYS2.
3. Add its binary directory (C:\MSYS64\usr\bin) to the front of PATH.
4. Run one of the above commands from cmd.exe, or equally from powershell.
In case it matters, the OS is Windows 11, and MSYS2's Perl is 5.36.0.
John Collins
More information about the tex-live
mailing list.