Homebrew-core: pstoedit broken with ghostscript 9.21

Created on 9 May 2017  路  18Comments  路  Source: Homebrew/homebrew-core

First off, I'm not sure if this bug-report is in the right place.

See output of `brew gist-log pstoedit https://gist.github.com/8736c7ae86be428271aafce8621d84ae

My installation of pstoedit is failing after updating to ghostscript 9.21. The simplest test case that mimics what I'm actually doing is a LaTeX document test.tex:

\documentclass{minimal}

\begin{document}
$\alpha$
\end{document}

which is compiled to test.pdf using

pdflatex -interaction=nonstopmode test.tex

Then the conversion of test.svg using pstoedit fails:

pstoedit -f plot-svg test.pdf test.svg

Output:

pstoedit: version 3.70 / DLL interface 108 (built: Jan 11 2017 - release build - g++ 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1) - 64-bit) : Copyright (C) 1993 - 2014 Wolfgang Glunz
Error: /invalidaccess in --.execinstall--
Operand stack:
   false   --dict:30/32(L)--   typecheck   --nostringval--   -grestore   grestore   false   --nostringval--   --nostringval--   grestore   --nostringval--   -definefont   definefont   false   --nostringval--   --nostringval--   definefont   --nostringval--   -stroke   stroke   false   --nostringval--   --nostringval--   stroke   --nostringval--   -gsave   gsave   false   --nostringval--   --nostringval--   gsave   --nostringval--   -ueofill   ueofill   false   --nostringval--   --nostringval--   ueofill   --nostringval--   -eofill   eofill   false   --nostringval--   --nostringval--   eofill   --nostringval--   -ufill   ufill   false   --nostringval--   --nostringval--   ufill   --nostringval--   -lt   lt   false   --nostringval--   --nostringval--   lt   --nostringval--   -shfill   shfill   false   --nostringval--   --nostringval--   shfill   --nostringval--   -string   string   false   --nostringval--   --nostringval--   string   --nostringval--   -glyphshow   glyphshow   false   --nostringval--   --nostringval--   glyphshow   --nostringval--   -showpage   showpage   false   --nostringval--   --nostringval--   showpage   --nostringval--   -awidthshow   awidthshow   false   --nostringval--   --nostringval--   awidthshow   --nostringval--   -rectstroke   rectstroke   false   --nostringval--   --nostringval--   rectstroke   --nostringval--   -ge   ge   false   --nostringval--   --nostringval--   ge   --nostringval--   -imagemask   imagemask   false   --nostringval--   --nostringval--   imagemask   --nostringval--   -image   image   false   --nostringval--   --nostringval--   image   --nostringval--   -rectfill   rectfill   false   --nostringval--   --nostringval--   rectfill   --nostringval--   -stringwidth   stringwidth   false   --nostringval--   --nostringval--   stringwidth   --nostringval--   -charpath   charpath   false   --nostringval--   --nostringval--   charpath   --nostringval--   -fill   fill   false   --nostringval--   --nostringval--   fill   --nostringval--   -setgstate   setgstate   false   --nostringval--   --nostringval--   setgstate   --nostringval--   -rectclip   rectclip   false   --nostringval--   --nostringval--   rectclip   --nostringval--   -colorimage   colorimage   false   --nostringval--   --nostringval--   colorimage   --nostringval--   -eoclip   eoclip   false   --nostringval--   --nostringval--   eoclip   --nostringval--   -clip   clip   false   --nostringval--   --nostringval--   clip   --nostringval--   -concat   concat   false   --nostringval--   --nostringval--   concat   --nostringval--   -ustroke   ustroke   false   --nostringval--   --nostringval--   ustroke   --nostringval--   -restore   restore   false   --nostringval--   --nostringval--   restore   --nostringval--   -currentcmykcolor   currentcmykcolor   false   --nostringval--   --nostringval--   currentcmykcolor   --nostringval--   -save   save   false   --nostringval--   --nostringval--   save   --nostringval--   -currentrgbcolor   currentrgbcolor   false   --nostringval--   --nostringval--   currentrgbcolor   --nostringval--   --dict:5/5(G)--   true   --dict:3/6(G)--   --nostringval--   --dict:75/75(ro)(L)--   --dict:3/6(G)--   --dict:1/10(L)--   --dict:75/84(ro)(L)--   --nostringval--   --dict:5/5(G)--   --dict:5/5(G)--   PDF->PS matrix   --nostringval--
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1982   1   3   %oparray_pop   1981   1   3   %oparray_pop   1965   1   3   %oparray_pop   1852   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   1982   229   3   %oparray_pop   1981   229   3   %oparray_pop   1965   229   3   %oparray_pop   --nostringval--   --nostringval--   2   1   1   --nostringval--   %for_pos_int_continue   --nostringval--   1945   230   7   %oparray_pop   --nostringval--   --nostringval--   false   1   %stopped_push   1946   237   7   %oparray_pop   --nostringval--   --nostringval--   --nostringval--
Dictionary stack:
   --dict:1208/1684(ro)(G)--   --dict:1/20(G)--   --dict:302/450(L)--   --dict:302/450(L)--   --dict:137/256(ro)(G)--   --dict:298/300(ro)(G)--   --dict:27/32(G)--
Current allocation mode is local
Last OS error: No such file or directory
Current file position is 87936
GPL Ghostscript 9.21: Unrecoverable error, exit code 1
PostScript/PDF Interpreter finished. Return status 256 executed command : /usr/local/opt/ghostscript/bin/gs -q -dDELAYBIND -dWRITESYSTEMDICT -dNODISPLAY -dNOEPS /var/folders/11/qf0tz9ws1q39bj4m993xnt0w0000gn/T//psiniZUYJM
The interpreter seems to have failed, cannot proceed !

P.S. Note that in Homebrew's test-case a problem is also encountered. However it seems that a file is created, albeit corrupted. It passes because the test-case seems to check for file creation only.

Most helpful comment

Similar problem

I've just installed pstoedit and got pstoedit v3.70 with ghostscript v9.21.

Convert .eps to .svg:

$ pstoedit -f plot-svg test.eps test.svg

then I got similar Ghostscript error as the OP GPL Ghostscript 9.21: Unrecoverable error, exit code 1

Full output:

$ pstoedit -f plot-svg test.eps test.svg
pstoedit: version 3.70 / DLL interface 108 (built: Jan 11 2017 - release build - g++ 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1) - 64-bit) : Copyright (C) 1993 - 2014 Wolfgang Glunz
Error: /invalidaccess in --dictstack--
Operand stack:
   false   --dict:30/32(L)--   typecheck   --nostringval--   -grestore   grestore   false   --nostringval--   --nostringval--   grestore   --nostringval--   -definefont   definefont   false   --nostringval--   --nostringval--   definefont   --nostringval--   -stroke   stroke   false   --nostringval--   --nostringval--   stroke   --nostringval--   -gsave   gsave   false   --nostringval--   --nostringval--   gsave   --nostringval--   -ueofill   ueofill   false   --nostringval--   --nostringval--   ueofill   --nostringval--   -eofill   eofill   false   --nostringval--   --nostringval--   eofill   --nostringval--   -ufill   ufill   false   --nostringval--   --nostringval--   ufill   --nostringval--   -lt   lt   false   --nostringval--   --nostringval--   lt   --nostringval--   -shfill   shfill   false   --nostringval--   --nostringval--   shfill   --nostringval--   -string   string   false   --nostringval--   --nostringval--   string   --nostringval--   -glyphshow   glyphshow   false   --nostringval--   --nostringval--   glyphshow   --nostringval--   -showpage   showpage   false   --nostringval--   --nostringval--   showpage   --nostringval--   -awidthshow   awidthshow   false   --nostringval--   --nostringval--   awidthshow   --nostringval--   -rectstroke   rectstroke   false   --nostringval--   --nostringval--   rectstroke   --nostringval--   -ge   ge   false   --nostringval--   --nostringval--   ge   --nostringval--   -imagemask   imagemask   false   --nostringval--   --nostringval--   imagemask   --nostringval--   -image   image   false   --nostringval--   --nostringval--   image   --nostringval--   -rectfill   rectfill   false   --nostringval--   --nostringval--   rectfill   --nostringval--   -stringwidth   stringwidth   false   --nostringval--   --nostringval--   stringwidth   --nostringval--   -charpath   charpath   false   --nostringval--   --nostringval--   charpath   --nostringval--   -fill   fill   false   --nostringval--   --nostringval--   fill   --nostringval--   -setgstate   setgstate   false   --nostringval--   --nostringval--   setgstate   --nostringval--   -rectclip   rectclip   false   --nostringval--   --nostringval--   rectclip   --nostringval--   -colorimage   colorimage   false   --nostringval--   --nostringval--   colorimage   --nostringval--   -eoclip   eoclip   false   --nostringval--   --nostringval--   eoclip   --nostringval--   -clip   clip   false   --nostringval--   --nostringval--   clip   --nostringval--   -concat   concat   false   --nostringval--   --nostringval--   concat   --nostringval--   -ustroke   ustroke   false   --nostringval--   --nostringval--   ustroke   --nostringval--   -restore   restore   false   --nostringval--   --nostringval--   restore   --nostringval--   -currentcmykcolor   currentcmykcolor   false   --nostringval--   --nostringval--   currentcmykcolor   --nostringval--   -save   save   false   --nostringval--   --nostringval--   save   --nostringval--   -currentrgbcolor   currentrgbcolor   false   --nostringval--   --nostringval--   currentrgbcolor   --nostringval--   --nostringval--
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1982   1   3   %oparray_pop   1981   1   3   %oparray_pop   1965   1   3   %oparray_pop   1852   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   1982   229   3   %oparray_pop   1982   229   3   %oparray_pop   1981   229   3   %oparray_pop   1965   229   3   %oparray_pop   1852   229   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--
Dictionary stack:
   --dict:1208/1684(ro)(G)--   --dict:0/20(G)--   --dict:304/450(L)--   --dict:57/75(G)--   --dict:2/10(G)--   --dict:53/70(G)--   --dict:1/1(G)--
Current allocation mode is global
Last OS error: No such file or directory
GPL Ghostscript 9.21: Unrecoverable error, exit code 1
PostScript/PDF Interpreter finished. Return status 256 executed command : /usr/local/opt/ghostscript/bin/gs -q -dDELAYBIND -dWRITESYSTEMDICT -dNODISPLAY -dNOEPS /var/folders/4f/_6trw3nj671f6h06pbv3ts5r0000gn/T//psinlqpvzu
The interpreter seems to have failed, cannot proceed !

My work around

Use ghostscript v9.20 instead of v9.21

1. Uninstall pstoedit and ghostscript

$ brew uninstall pstoedit
$ brew uninstall ghostscript

2. Install ghostscript v9.20

brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/79e814b80c470c894d24e5b37108c5bacaf45a80/Formula/ghostscript.rb

3. Install pstoedit with --ignore-dependencies so it doesn't install ghostscript v9.21

$ brew install pstoedit --ignore-dependencies

4. pstoedit should now work

$ pstoedit -f plot-svg test.eps test.svg
pstoedit: version 3.70 / DLL interface 108 (built: Jan 11 2017 - release build - g++ 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1) - 64-bit) : Copyright (C) 1993 - 2014 Wolfgang Glunz

All 18 comments

Is there any chance you can build pstoedit outside of Homebrew, so we can confirm if it's a bug in our packaging or not?

I will try to build both pstoedit and gs, and post my findings here.

Can reproduce locally on Homebrew's sample PDF file:

pstoedit -f pdf /usr/local/Homebrew/Library/Homebrew/test/support/fixtures/test.pdf b.pdf

gives the same error as the OP.

Similar problem

I've just installed pstoedit and got pstoedit v3.70 with ghostscript v9.21.

Convert .eps to .svg:

$ pstoedit -f plot-svg test.eps test.svg

then I got similar Ghostscript error as the OP GPL Ghostscript 9.21: Unrecoverable error, exit code 1

Full output:

$ pstoedit -f plot-svg test.eps test.svg
pstoedit: version 3.70 / DLL interface 108 (built: Jan 11 2017 - release build - g++ 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1) - 64-bit) : Copyright (C) 1993 - 2014 Wolfgang Glunz
Error: /invalidaccess in --dictstack--
Operand stack:
   false   --dict:30/32(L)--   typecheck   --nostringval--   -grestore   grestore   false   --nostringval--   --nostringval--   grestore   --nostringval--   -definefont   definefont   false   --nostringval--   --nostringval--   definefont   --nostringval--   -stroke   stroke   false   --nostringval--   --nostringval--   stroke   --nostringval--   -gsave   gsave   false   --nostringval--   --nostringval--   gsave   --nostringval--   -ueofill   ueofill   false   --nostringval--   --nostringval--   ueofill   --nostringval--   -eofill   eofill   false   --nostringval--   --nostringval--   eofill   --nostringval--   -ufill   ufill   false   --nostringval--   --nostringval--   ufill   --nostringval--   -lt   lt   false   --nostringval--   --nostringval--   lt   --nostringval--   -shfill   shfill   false   --nostringval--   --nostringval--   shfill   --nostringval--   -string   string   false   --nostringval--   --nostringval--   string   --nostringval--   -glyphshow   glyphshow   false   --nostringval--   --nostringval--   glyphshow   --nostringval--   -showpage   showpage   false   --nostringval--   --nostringval--   showpage   --nostringval--   -awidthshow   awidthshow   false   --nostringval--   --nostringval--   awidthshow   --nostringval--   -rectstroke   rectstroke   false   --nostringval--   --nostringval--   rectstroke   --nostringval--   -ge   ge   false   --nostringval--   --nostringval--   ge   --nostringval--   -imagemask   imagemask   false   --nostringval--   --nostringval--   imagemask   --nostringval--   -image   image   false   --nostringval--   --nostringval--   image   --nostringval--   -rectfill   rectfill   false   --nostringval--   --nostringval--   rectfill   --nostringval--   -stringwidth   stringwidth   false   --nostringval--   --nostringval--   stringwidth   --nostringval--   -charpath   charpath   false   --nostringval--   --nostringval--   charpath   --nostringval--   -fill   fill   false   --nostringval--   --nostringval--   fill   --nostringval--   -setgstate   setgstate   false   --nostringval--   --nostringval--   setgstate   --nostringval--   -rectclip   rectclip   false   --nostringval--   --nostringval--   rectclip   --nostringval--   -colorimage   colorimage   false   --nostringval--   --nostringval--   colorimage   --nostringval--   -eoclip   eoclip   false   --nostringval--   --nostringval--   eoclip   --nostringval--   -clip   clip   false   --nostringval--   --nostringval--   clip   --nostringval--   -concat   concat   false   --nostringval--   --nostringval--   concat   --nostringval--   -ustroke   ustroke   false   --nostringval--   --nostringval--   ustroke   --nostringval--   -restore   restore   false   --nostringval--   --nostringval--   restore   --nostringval--   -currentcmykcolor   currentcmykcolor   false   --nostringval--   --nostringval--   currentcmykcolor   --nostringval--   -save   save   false   --nostringval--   --nostringval--   save   --nostringval--   -currentrgbcolor   currentrgbcolor   false   --nostringval--   --nostringval--   currentrgbcolor   --nostringval--   --nostringval--
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1982   1   3   %oparray_pop   1981   1   3   %oparray_pop   1965   1   3   %oparray_pop   1852   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   1982   229   3   %oparray_pop   1982   229   3   %oparray_pop   1981   229   3   %oparray_pop   1965   229   3   %oparray_pop   1852   229   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--
Dictionary stack:
   --dict:1208/1684(ro)(G)--   --dict:0/20(G)--   --dict:304/450(L)--   --dict:57/75(G)--   --dict:2/10(G)--   --dict:53/70(G)--   --dict:1/1(G)--
Current allocation mode is global
Last OS error: No such file or directory
GPL Ghostscript 9.21: Unrecoverable error, exit code 1
PostScript/PDF Interpreter finished. Return status 256 executed command : /usr/local/opt/ghostscript/bin/gs -q -dDELAYBIND -dWRITESYSTEMDICT -dNODISPLAY -dNOEPS /var/folders/4f/_6trw3nj671f6h06pbv3ts5r0000gn/T//psinlqpvzu
The interpreter seems to have failed, cannot proceed !

My work around

Use ghostscript v9.20 instead of v9.21

1. Uninstall pstoedit and ghostscript

$ brew uninstall pstoedit
$ brew uninstall ghostscript

2. Install ghostscript v9.20

brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/79e814b80c470c894d24e5b37108c5bacaf45a80/Formula/ghostscript.rb

3. Install pstoedit with --ignore-dependencies so it doesn't install ghostscript v9.21

$ brew install pstoedit --ignore-dependencies

4. pstoedit should now work

$ pstoedit -f plot-svg test.eps test.svg
pstoedit: version 3.70 / DLL interface 108 (built: Jan 11 2017 - release build - g++ 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1) - 64-bit) : Copyright (C) 1993 - 2014 Wolfgang Glunz

I can confirm the workaround.

I can also confirm that my local build Ghostscript 9.21 + pstoedit 3.70 combination seems to work.

I can also confirm that my local build Ghostscript 9.21 + pstoedit 3.70 combination seems to work.

Meaning your pstoedit built outside of Homebrew? Maybe we just need to add a revision to the formula.

Naively I have built both Ghostscript and pstoedit outside Homebrew... Also I think that the problems started with update Ghostscript, not pstoedit (but a mind can be a tricky thing, so I might be mistaken).

Oh that makes since, because we revisioned pstoedit already anyway.

This looks like it might be the upstream GS bug: https://bugs.ghostscript.com/show_bug.cgi?id=697846

The upstream bug seems indeed quite similar.

However I cannot directly link the fact that my local build gs9.21 did work? If it has been patched there, also a fresh Homebrew install might work, because one would assume that it selects the patched version right? But is doesn't....?

This implies that it might only be resolved when gs9.22 comes out, which, judging from the history, is only in about five months.

If that upstream patch fixes it, we can backport it ourselves to 9.21.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

I'm a bit confused how to proceed from here?

Could you try applying the upstream patch in the formula using a patch do block?

I can confirm that applying

patch do
   url "https://git.ghostscript.com/?p=ghostpdl.git;a=patch;h=57f20719"
end

solves the issue.

I am however not familiar with propagating this patch within Homebrew. Can you comment?

@tdegeus this should be fixed now if you brew update and brew upgrade ghostscript.

Great, thanks for the help! Problem solved.

@tdegeus you're welcome!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Thirudhas picture Thirudhas  路  4Comments

ghostbar picture ghostbar  路  4Comments

ghost picture ghost  路  3Comments

jakepetroules picture jakepetroules  路  3Comments

faraazkhan picture faraazkhan  路  3Comments