mgieseki / dvisvgm

A fast DVI, EPS, and PDF to SVG converter
https://dvisvgm.de
GNU General Public License v3.0
312 stars 34 forks source link

Warnings in release candidate of gs 10.2.0 when -dOLDPDF and -dNEWPDF are used #245

Closed bgvoisin closed 1 year ago

bgvoisin commented 1 year ago

The first release candidate of the next Ghostscript version, 10.2.0, has just been made available today at

https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/tag/gs10020rc1

With it, -dOLDPDF and -dNEWPDF have become obsolete and do nothing, warnings are issued when these are used, like

   **** WARNING ****
The old, written in PostScript, PDF interpreter has been removed entirely.
You should cease using -dOLDPF as it has no effect now.
Continuing to process PDF file using the new, written in C, PDF interpreter.

and similarly for -dNEWPDF.

This seems to confuse dvisvgm. To convert an EPS file, applying exactly the same command that worked yesterday with gs 10.1.2, I get with 10.02.0rc1

% dvisvgm --verbosity=7 --eps golfer.eps --output=%f-eps-new.svg
The old, written in PostScript, PDF interpreter has been removed entirely.
You should cease using -dNEWDPF as it has no effect nprocessing EPS file
  PostScript error: stackunderflow in copyOperand stack:
      0

The warning is also returned when mutool is used to convert a PDF file, I imagine when the gs version is tested for, before switching to mutool when the version is 10.1.0 or above:

% dvisvgm --verbosity=7 --pdf golfer.pdf --output=%f-pdf-new.svg
The old, written in PostScript, PDF interpreter has been removed entirely.
You should cease using -dNEWDPF as it has no effect nprocessing PDF file
  graphic size: 572.1375pt x 697.60625pt (201.083333mm x 245.180556mm)
  output written to golfer-pdf-new.svg
1 of 1 page converted in 0.111178 seconds

I'm reporting this in case this means interaction with the gs developers is required before the release.

mgieseki commented 1 year ago

Thank you for reporting this behavior. There are actually two issues involved. The message about the deprecated option -dNEWPDF is purely informational and should not lead to a stack underflow. After some investigation, it turned out that as of GS 10.02.0, the copy operator now expects at least two operands on the stack even if the number of elements to copy is 0. Therefore, clear 0 copy -- which simply does nothing in the previous releases -- now quits with a stack underflow error. Here's my corresponding ticket: https://bugs.ghostscript.com/show_bug.cgi?id=707050

I've prepared patches that fix the copy error and the deprecation message. They need a bit more testing. I'll probably commit them tomorrow.

mgieseki commented 1 year ago

The stackunderflow issue has been fixed in the GS repo: https://git.ghostscript.com/?p=ghostpdl.git;h=9e64c191228b4c026d50fc6e1e4fd5f80d2df881 So, I'm going to revert my local changes because dvisvgm no longer needs a fix for it.