[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: printer trouble



On Fri, 7 Nov 1997, E.L. Meijer (Eric) wrote:

> Hello everyone,

Hi!

> 
> I recently got a problem with a printer filter used by lpr.  The filter
> is used for a HP Deskjet 870 cxi, and used to work properly on this
> machine, and still does on other machines:
> 
> The princap entry is [OMITTED]
> 
> The filter /etc/filters/filter870.ps looks like:
> ------------------------------------------------------------------------
> #!/bin/sh
> 
> /usr/bin/gs     -sDEVICE=cdj550 \
>                 -q \
>                 -r300x300 \
>                 -sPAPERSIZE=a4 \
>                 -dNOPAUSE \
>                 -dSAFER \
>                 -sOutputFile=- \
>                 - | \
> lpr -Php870raw
> ------------------------------------------------------------------------
> 
> hp870raw is a remote printer.  The problem might be caused by the
> fact that gs was recently replaced with Alladin-gs, version 4.03-7.  If
> I run `lpr -Pcol1 bla.ps', I see with ps -eaxfwww that gs is run with
> the following arguments:
> /usr/bin/gs -sDEVICE=lvga256 -sDEVICE=cdj550 -q -r300x300 -sPAPERSIZE=a4 ...
>              ^^^^^^^^^^^^^^^
> It doesn't stop, and nothing gets printed.
> 
> Now who or what put -sDEVICE=lvga256 there?  I printed the environment
> from the filter, and did not see a GS_DEVICE variable.  I tried to set
> the GS_DEVICE variable in the filter, but it didn't help.  

It is gs that put -sDEVICE=lvga256 there! In fact, /usr/bin/gs is not
the "real" program, it is just a wrapper, which, in particular,
adds the parameter above as an then calls /usr/bin.gs.main, whihc
is the "real" program. The parameter is added when gs thinks that the
program is running outside X11, so that the svga device is used as the 
default one (if the fprogram is running under X11, the X device is the 
default one). 

In any case, the -sDEVICE=cdj550 overwrites the default device, so this
is not the cause of the problem.

> Even more
> mysterious, if I run `filter870.ps < bla.ps', it works correctly!

However, this should not work if you execute the script as root
(In fact i think that the problem occurs since your filter is executed 
with root permissions).

If gs is executed with superuser permissions, it tries to initialize the 
svga library and this produces garbage messages on the stdout
something like "Svga libraries version xxx.yyy, using virtual console #7";
these messages are sent to the printer, which gets confused and does not
print correctly.

To see if this is the cause of the problem, you can execute
   filter870.ps < bla.ps 
as root: it should NOT print correctly.

Solutions:

1) It is dangerous to execute gs with root privileges (the file 
/usr/doc/gs/README.something should explain why), so you should 
modify (or change) your lpr program, so that the filter are called 
without root permissions.

2) You can move to a more recent version of gs-aladdin (gs-aladding 5.03
should work correctly; unfortunately i have a lot a problems to uplopad it;
for the moment, you can find the package at
http://www.di.unipi.it/~pistore/gs-aladdin_5.03-0.99_i386.deb

3) You can modify the filter, so that it looks like

#!/bin/sh
 
/usr/bin/gs     -sDEVICE=cdj550 \
                -q \
                -r300x300 \
                -sPAPERSIZE=a4 \
                -dNOPAUSE \
                -dSAFER \
                -sOutputFile=\|"cat 1>&3" \
                - \
                3>&1 1>&2 | \
lpr -Php870raw

In this way, the real output of gs is not confused with the garbage 
output of the svgalibs.

(In the case of your filter, it can also be rewritten as follows:

#!/bin/sh

/usr/bin/gs     -sDEVICE=cdj550 \
                -q \
                -r300x300 \
                -sPAPERSIZE=a4 \
                -dNOPAUSE \
                -dSAFER \
                -sOutputFile=\|"lpr -Php870" \
                - 1>&2 

however some other filters require that the output of gs is sent on
stdout.)

Hopefully this will solve your problems...

Ciao,

Marco


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: