Bug 691137 - "Can't refill scanner input buffer" error when Ubuntu test page (PostScript) fed into GS via stdin
Summary: "Can't refill scanner input buffer" error when Ubuntu test page (PostScript) ...
Status: RESOLVED DUPLICATE of bug 690909
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: PS Interpreter (show other bugs)
Version: 8.71
Hardware: PC Linux
: P4 major
Assignee: Alex Cherepanov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-23 13:47 UTC by Till Kamppeter
Modified: 2010-02-23 15:06 UTC (History)
0 users

See Also:
Customer:
Word Size: ---


Attachments
testpage-a4.ps (149.20 KB, application/postscript)
2010-02-23 13:49 UTC, Till Kamppeter
Details
ps2pdfwr (1.15 KB, text/plain)
2010-02-23 14:49 UTC, Till Kamppeter
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Till Kamppeter 2010-02-23 13:47:23 UTC
If I run these command lines:

1. cat /usr/share/system-config-printer/testpage-a4.ps | gs -

2. cat /usr/share/system-config-printer/testpage-a4.ps | /usr/bin/ps2pdf13
-dAutoRotatePages=/None -dAutoFilterColorImages=false -dNOPLATFONTS
-dPARANOIDSAFER -sstdout=%stderr -dColorImageFilter=/FlateEncode
-dPDFSETTINGS=/printer -dDoNumCopies - out.pdf

I get the following error:

GPL Ghostscript 8.71: ./psi/iscan.c(333): Can't refill scanner input buffer!GPL
Ghostscript 8.71: Unrecoverable error, exit code 255

This happens after the frames are rendered (out.pdf contains only the frames).

Supplying the input file directly on the command line (at the places where the
single "-" are) they get correctly rendered.

Ghostscript is version 8.71 on Ubuntu Lucid, 64-bit.
Comment 1 Till Kamppeter 2010-02-23 13:49:07 UTC
Created attachment 5982 [details]
testpage-a4.ps

Offending file: Ubuntu test page.
Comment 2 Till Kamppeter 2010-02-23 14:48:22 UTC
Problem is that the PS Interpreter tries to seek on the input file for certain
files. A fix would be to avoid seeking under all circumstances, for example by
reading bigger pieces into a buffer.

A workaround is to never call Ghostscript with "-" as input file but always use
"-_" instead. For this especially also all scripts which come with Ghostscript
need to be fixed. See the attached ps2pdfwr as an example. The additional

if [ "${infile}" = "-" ]; then
    infile="-_"
fi

solves the problem when any ps2pdf* script is used.
Comment 3 Till Kamppeter 2010-02-23 14:49:59 UTC
Created attachment 5983 [details]
ps2pdfwr

ps2pdfwr which uses "-_" instead of "-" in its Ghostscript call when input
comes from stdin.
Comment 4 Alex Cherepanov 2010-02-23 15:06:59 UTC

*** This bug has been marked as a duplicate of 690909 ***