pts / pdfsizeopt

PDF file size optimizer
GNU General Public License v2.0
750 stars 65 forks source link

--tmp-dir=... not respected if --do-debug-gs=yes is specified #130

Closed ageis closed 1 year ago

ageis commented 5 years ago

Hi there. I tried updating some binaries in the libexec folder. There are newer versions of optipng, sam2p, pngout, png22pnm, jbig2 and zopflipng available, as well as gs.

You have Ghostscript 9.05. The Type1CConverter fails for me with version 9.27. It seems to ignore what I set for --tmp-dir as well as the TEMP/TMPDIR environment variables and passes /dev/null to Ghostscript regardless.

Here is example output and my arguments.

$ GS_LIB=/usr/share/ghostscript/fonts ./pdfsizeopt.single --v=999 --do-debug-gs=yes --tmp-dir=/var/tmp --do-double-check-type1c-output=yes --do-unify-fonts=no --do-regenerate-all-fonts=no input.pdf output.pdf
info: This is pdfsizeopt ZIP rUNKNOWN size=69734.
info: prepending to PATH: /home/kevin/dev/pdfsizeopt/pdfsizeopt_libexec
info: PATH: /home/kevin/dev/pdfsizeopt/pdfsizeopt_libexec:/usr/bin:/bin:/usr/local/bin
info: getcwd: /home/kevin/dev/pdfsizeopt
info: verifying Ghostscript: TMPDIR=///dev/null TEMP=///dev/null gs
info: output from Ghostscript: 'GPL Ghostscript 9.27 (2019-04-04)\nCopyright (C) 2018 Artifex Software, Inc.  All rights reserved.\nThis software is supplied under the GNU AGPLv3 and comes with NO WARRANTY:\nsee the file COPYING for details.\n/GSOK\n'
info: Ghostscript version info: 'GPL Ghostscript 9.27 (2019-04-04); see the file COPYING for details.'
info: using Ghostscript TMPDIR=///dev/null TEMP=///dev/null gs: GPL Ghostscript 9.27 (2019-04-04); see the file COPYING for details.
info: found working Ghostscript: TMPDIR=///dev/null TEMP=///dev/null gs
info: loading PDF from: /home/kevin/dev/pdfsizeopt/input.pdf
info: loaded PDF of 464896 bytes
info: decompressing 69 bytes with Ghostscript /Filter/FlateDecode/DecodeParms <</Columns 5/Predictor 12>>
info: decompressing 34 bytes with Ghostscript /Filter/FlateDecode/DecodeParms <</Columns 5/Predictor 12>>
info: found 57 obj offsets and 1 obj streams in xref stream
info: separated to 54 objs + xref + trailer
info: parsed 54 objs
info: eliminated 2 unused objs, depth=8
info: found 5 Type1 fonts loaded
info: writing Type1CConverter (73923 font bytes) to: /var/tmp/psotmp.426467.conv.tmp.ps
info: executing Type1CConverter with Ghostscript: TMPDIR=///dev/null TEMP=///dev/null gs -q -P- -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dPDFSETTINGS=/printer -dColorConversionStrategy=/LeaveColorUnchanged -sOutputFile=/var/tmp/psotmp.426467.conv.tmp.pdf -f /var/tmp/psotmp.426467.conv.tmp.ps
GPL Ghostscript 9.27: **** Could not open temporary file ///dev/null/gs_Fer2LJ
**** Unable to open the initial device, quitting.
fatal: Type1CConverter failed, status=0x100
pts commented 1 year ago

Thank you for reporting this! It was a bug causing --tmp-dir=... to be ignored when --do-debug-gs=yes was specified. Fixed in 98358a7d84552f07643dad75c323702da1ee6d1d.