Package: ghostscript
Version: 9.06~dfsg-2+deb8u1
Severity: important

Dear Maintainer,

Short version:

* What led up to the situation?

"gs -o proper.pdf -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress 
programmheft_2016.pdf" with 
http://www.naturpark-rheinland.de/programmheft_2016.pdf leads to infinite 
output of "**** File has unbalanced q/Q operators (too many Q's) ****" to stderr

* What exactly did you do (or not do) that was effective (or ineffective)?

A) Compiled upstream ghostscript 9.06 and executed the command above
B) Use the upstream ghostscript Resources directory instead of 
/usr/share/ghostscript/Resources

* What was the outcome of this action?

A) Worked without problems
B) Leads at least to an unrecoverable error instead

* What outcome did you expect instead?

Debians ghostscript package to work as upstream correctly rendering the PDF.


Long version:

One of our Debian wheezy webservers (ghostscript "9.05~dfsg-6.3+deb7u2") was 
brought down yesterday morning by running out of diskspace very quickly due to 
a spammed /var/log/apache2/error.log with 700GB of lines with 

"**** File has unbalanced q/Q operators (too many Q's) ****". 

It turned out this was due to a process trying to create a thumbnail image of a 
pdf file

"gs -q -dBATCH -dMaxBitmap=50000000 -dNOPAUSE -sDEVICE=pnmraw -dTextAlphaBits=4 
-dGraphicsAlphaBits=4 -r72x72 -dFirstPage=1 -dLastPage=1 -sOutputFile=XXX -- 
YYY -c quit"

The issue is reproducible on a Debian jessie server (ghostscript 
"9.06~dfsg-2+deb8u1") too by simply executing 

"gs -o proper.pdf -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress 
programmheft_2016.pdf"

The file is available for download at 
http://www.naturpark-rheinland.de/programmheft_2016.pdf 

All pdf viewers I tried had no problems displaying the file.

I asked for help at #ghostscript, you can find the log here: 
http://ghostscript.com/irclogs/2016/01/05.html

I compiled both gs905 and gs906 from ghostscripts git sources and could execute

"./gs -o proper.pdf -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress 
programmheft_2016.pdf"

without errors.

Using the Resource folder of upstream ghostscript for the debian ghostscript 
package by executing

"gs -I../Resource/Init -o proper.pdf -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress 
programmheft_2016.pdf"

leads to 

Error: /rangecheck in --run--
Operand stack:
   --dict:12/21(L)--   1   11   3   --nostringval--   false   76666   
DataSource   --nostringval--   0   16   --nostringval--   12   --dict:2/2(L)--
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   
--nostringval--   2   %stopped_push   --nostringval--   --nostringval--   
--nostringval--   false   1   %stopped_push   1910   1   3   %oparray_pop   
1909   1   3   %oparray_pop   1893   1   3   %oparray_pop   --nostringval--   
--nostringval--   2   1   1   --nostringval--   %for_pos_int_continue   
--nostringval--   --nostringval--   false   1   %stopped_push   --nostringval-- 
  --nostringval--
Dictionary stack:
   --dict:1168/1684(ro)(G)--   --dict:1/20(G)--   --dict:83/200(L)--   
--dict:83/200(L)--   --dict:109/127(ro)(G)--   --dict:293/300(ro)(G)--   
--dict:25/31(L)--   --dict:6/8(L)--   --dict:25/40(L)--   --dict:1/1(ro)(G)--   
--dict:14/15(L)--   --dict:1/1(ro)(G)--   --dict:4/5(L)--   --dict:1/1(ro)(G)-- 
  --dict:7/15(L)--   --dict:9/20(L)--
Current allocation mode is local
GPL Ghostscript 9.06: Unrecoverable error, exit code 1

which is an unrecoverable error but at least no infinite spamming of the error 
log.

As a workaround I use this on our servers now:

git clone --single-branch --branch gs906 
"http://git.ghostscript.com/ghostpdl.git"; ~/ghostpdl
mkdir /usr/local/share/ghostscript/
mv ~/ghostpdl/gs/Resource /usr/local/share/ghostscript/
rm -rf ~/ghostpdl
echo "GS_LIB=/usr/local/share/ghostscript/Resource/Init" >> /etc/environment

Since the problem does not exist on upstream ghostscript 9.05 or 9.06 but only 
in the debian package it must be due to differences between these too. This are 
the differences in Resource/Init/* http://pastebin.com/emSHcUFE

-- System Information:
Debian Release: 8.2
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages ghostscript depends on:
ii  debconf [debconf-2.0]  1.5.56
ii  gsfonts                1:8.11+urwcyr1.0.7~pre44-4.2
ii  libc6                  2.19-18+deb8u1
ii  libgs9                 9.06~dfsg-2+deb8u1

ghostscript recommends no packages.

Versions of packages ghostscript suggests:
pn  ghostscript-x  <none>

-- no debconf information

Reply via email to