[tex-k] epstopdf not usable in Git Bash for Windows

Pablo González L pablgonz at educarchile.cl
Mon Apr 1 00:39:18 CEST 2024


Steps to reproduce the problem under Git-bash windows (TL24, win11)

pablg at RayzenTeX MINGW64 ~
$ pwd
/c/Users/pablg

pablg at RayzenTeX MINGW64 ~
$ perl -e 'print $^O ;'
msys
pablg at RayzenTeX MINGW64 ~
$ cp $(kpsewhich example-image.eps) example-eps.eps

pablg at RayzenTeX MINGW64 ~
$ ls -lh example-eps.eps
-rw-r--r-- 1 pablg 197609 51K mar. 31 18:40 example-eps.eps

pablg at RayzenTeX MINGW64 ~
$ cat test.tex
\documentclass{article}
\usepackage{graphicx}
\begin{document}
  \includegraphics{example-eps.eps}
\end{document}

pablg at RayzenTeX MINGW64 ~
$ pdflatex test.tex
This is pdfTeX, Version 3.141592653-2.6-1.40.26 (TeX Live 2024)
(preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
(./test.tex
LaTeX2e <2023-11-01> patch level 1
L3 programming layer <2024-03-14>
(c:/texlive/2024/texmf-dist/tex/latex/base/article.cls
Document Class: article 2023/05/17 v1.4n Standard LaTeX document class
(c:/texlive/2024/texmf-dist/tex/latex/base/size10.clo))
(c:/texlive/2024/texmf-dist/tex/latex/graphics/graphicx.sty
(c:/texlive/2024/texmf-dist/tex/latex/graphics/keyval.sty)
(c:/texlive/2024/texmf-dist/tex/latex/graphics/graphics.sty
(c:/texlive/2024/texmf-dist/tex/latex/graphics/trig.sty)
(c:/texlive/2024/texmf-dist/tex/latex/graphics-cfg/graphics.cfg)
(c:/texlive/2024/texmf-dist/tex/latex/graphics-def/pdftex.def)))
(c:/texlive/2024/texmf-dist/tex/latex/l3backend/l3backend-pdftex.def)
No file test.aux.
(c:/texlive/2024/texmf-dist/tex/context/base/mkii/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
) (c:/texlive/2024/texmf-dist/tex/latex/epstopdf-pkg/epstopdf-base.sty
(c:/texlive/2024/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg))epstopdf
($Id: epstopdf.pl 68289 2023-09-15 22:17:54Z karl $) 2.33
!!! Error: Required program ./../../../bin/windows/kpsewhich not
found, given explicit Windows directory
C:\texlive\2024\bin\windows\runscript.tlu:921: command failed with exit code 2:
perl.exe c:\texlive\2024\texmf-dist\scripts\epstopdf\epstopdf.pl
--restricted "--outfile=example-eps-eps-converted-to.pdf"
"example-eps.eps"
system returned with code 2


! Package pdftex.def Error: File `example-eps-eps-converted-to.pdf' not found:
using draft setting.

See the pdftex.def package documentation for explanation.
Type  H <return>  for immediate help.
 ...

l.4   \includegraphics{example-eps.eps}

?
[1{c:/texlive/2024/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (./test.aux)
)<c:/texlive/2024/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb><c:/texli
ve/2024/texmf-dist/fonts/type1/public/amsfonts/cm/cmtt10.pfb>
Output written on test.pdf (1 page, 20918 bytes).
Transcript written on test.log.

*** ANALISIS ***


Here clearly the problem is how the PATH is separated within the
script, on line 217 we have

my $on_windows = $^O =~ /^(MSWin|msys$)/;

which is probably confusing split in:

  # not absolute, check path
  for my $dir (split ($on_windows ? ";" : ":", $ENV{"PATH"})) {

In simple terms, `cygwin` and `Git-bash` (msys) should be treated in
the same way using ":" as a separator in the PATH.

*** --restricted ***

Now let's look at a second issue related to `--restricted` option
passed directly to `epstopdf.pl` by making a copy of it under Git-bash
(using wraped perl 5, version 36 provided by Git-bash).

pablg at RayzenTeX MINGW64 ~
$ cp /c/texlive/2024/texmf-dist/scripts/epstopdf/epstopdf.pl epstopdf-local.pl

pablg at RayzenTeX MINGW64 ~
$ perl epstopdf-local.pl --debug --restricted example-eps.eps
* on_windows=1, on_windows_or_cygwin=1
* Restricted mode activated
* Restricted Windows kpsewhich: ./../../../bin/windows/kpsewhich
* Restricted Windows gs: gswin32c
* kpsewhich command: ./../../../bin/windows/kpsewhich
*  Checking if ./../../../bin/windows/kpsewhich is in PATH
epstopdf ($Id: epstopdf.pl 68289 2023-09-15 22:17:54Z karl $) 2.33
!!! Error: Required program ./../../../bin/windows/kpsewhich not
found, given explicit Windows directory

pablg at RayzenTeX MINGW64 ~
$ perl epstopdf-local.pl --debug example-eps.eps
* on_windows=1, on_windows_or_cygwin=1
* kpsewhich command: kpsewhich
*  Checking if kpsewhich is in PATH
*  Checking dir
/c/Users/pablg/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Users/pablg/bin:/c/Program
Files (x86)/Common
Files/Oracle/Java/javapath:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/WINDOWS/System32/WindowsPowerShell/v1.0:/c/WINDOWS/System32/OpenSSH:/c/Program
Files/gs/gs10.02.1/bin:/c/Strawberry/c/bin:/c/Strawberry/perl/site/bin:/c/Strawberry/perl/bin:/cmd:/c/Program
Files/PowerShell/7:/c/texlive/2024/bin/windows:/c/texlive/2024/bin/windows:/c/Users/pablg/AppData/Local/Microsoft/WindowsApps:/usr/bin/vendor_perl:/usr/bin/core_perl
epstopdf ($Id: epstopdf.pl 68289 2023-09-15 22:17:54Z karl $) 2.33
!!! Error: Required program kpsewhich not found in PATH
(/c/Users/pablg/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Users/pablg/bin:/c/Program
Files (x86)/Common
Files/Oracle/Java/javapath:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/WINDOWS/System32/WindowsPowerShell/v1.0:/c/WINDOWS/System32/OpenSSH:/c/Program
Files/gs/gs10.02.1/bin:/c/Strawberry/c/bin:/c/Strawberry/perl/site/bin:/c/Strawberry/perl/bin:/cmd:/c/Program
Files/PowerShell/7:/c/texlive/2024/bin/windows:/c/texlive/2024/bin/windows:/c/Users/pablg/AppData/Local/Microsoft/WindowsApps:/usr/bin/vendor_perl:/usr/bin/core_perl)

The same now from CMD (not Git-bash) with perl (v5.38.0) straberry

C:\Users\pablg>perl -v

This is perl 5, version 38, subversion 0 (v5.38.0) built for
MSWin32-x64-multi-thread

C:\Users\pablg>perl epstopdf-git.pl --debug --restricted example-eps.eps
* on_windows=1, on_windows_or_cygwin=1
* Restricted mode activated
* Restricted Windows kpsewhich: ./../../../bin/windows/kpsewhich
* Restricted Windows gs: ./../../../tlpkg/tlgs/bin/gswin64c
* kpsewhich command: ./../../../bin/windows/kpsewhich
*  Checking if ./../../../bin/windows/kpsewhich is in PATH
epstopdf ($Id: epstopdf.pl 68289 2023-09-15 22:17:54Z karl $) 2.33
!!! Error: Required program ./../../../bin/windows/kpsewhich not
found, given explicit Windows directory

C:\Users\pablg>perl epstopdf-git.pl --debug example-eps.eps
* on_windows=1, on_windows_or_cygwin=1
* kpsewhich command: kpsewhich
*  Checking if kpsewhich is in PATH
*  Checking dir C:\Program Files (x86)\Common Files\Oracle\Java\javapath
*  Checking dir C:\WINDOWS\system32
*  Checking dir C:\WINDOWS
*  Checking dir C:\WINDOWS\System32\Wbem
*  Checking dir C:\WINDOWS\System32\WindowsPowerShell\v1.0\
*  Checking dir C:\WINDOWS\System32\OpenSSH\
*  Checking dir C:\Program Files\gs\gs10.02.1\bin
*  Checking dir C:\Strawberry\c\bin
*  Checking dir C:\Strawberry\perl\site\bin
*  Checking dir C:\Strawberry\perl\bin
*  Checking dir C:\Program Files\Git\cmd
*  Checking dir C:\Program Files\PowerShell\7\
*  Checking dir C:\texlive\2024\bin\windows
* Input filename: example-eps.eps
* GS command: gswin64c
*  Checking if gswin64c is in PATH
*  Checking dir C:\Program Files (x86)\Common Files\Oracle\Java\javapath
*  Checking dir C:\WINDOWS\system32
*  Checking dir C:\WINDOWS
*  Checking dir C:\WINDOWS\System32\Wbem
*  Checking dir C:\WINDOWS\System32\WindowsPowerShell\v1.0\
*  Checking dir C:\WINDOWS\System32\OpenSSH\
*  Checking dir C:\Program Files\gs\gs10.02.1\bin
* Output filename: example-eps.pdf
* BoundingBox comment: %%BoundingBox:
* Ghostscript command: gswin64c
* Compression: on
* Embedding: on
* Grayscale: off
* PDFSettings: prepress
* Resolution: [use gs default]
* Rotation: None
* Using temporary file 'C:\Users\pablg\AppData\Local\Temp\ZhPIi_jX1q'
* Binary junk at start of file: 0 byte(s)
* Scanning header for BoundingBox
* Old BoundingBox: 0 0 320 240
* New BoundingBox: 0 0 320 240
* Offset: 0 0
* Ghostscript command: gswin64c -dSAFER -dNOPAUSE -dBATCH
-dCompatibilityLevel=1.5 -sDEVICE=pdfwrite
-sOutputFile=example-eps.pdf -dPDFSETTINGS#/prepress
-dMaxSubsetPct=100 -dSubsetFonts=true -dEmbedAllFonts=true
-dAutoRotatePages#/None C:\Users\pablg\AppData\Local\Temp\ZhPIi_jX1q
-c quit
GPL Ghostscript 10.02.1 (2023-11-01)
Copyright (C) 2023 Artifex Software, Inc.  All rights reserved.
This software is supplied under the GNU AGPLv3 and comes with NO WARRANTY:
see the file COPYING for details.
* Done.

Here something strange happens with `--restricted` (but I can't see
what it is), I think the problem is in the path returned under Windows
for `kpsewhich` works only (unexpectedly for my) when calling `epstopdf`
directly (without using `$perl epstopdf.pl`).


More information about the tex-k mailing list.