From barner@in.tum.de  Mon Apr 19 08:24:08 2004
Return-Path: <barner@in.tum.de>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 5EFCE16A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 19 Apr 2004 08:24:08 -0700 (PDT)
Received: from mailout1.informatik.tu-muenchen.de (mailout1.informatik.tu-muenchen.de [131.159.0.18])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 7233343D55
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 19 Apr 2004 08:24:07 -0700 (PDT)
	(envelope-from barner@in.tum.de)
Received: by zi025.glhnet.mhn.de (Postfix, from userid 1000)
	id C1AF9487D; Mon, 19 Apr 2004 17:23:41 +0200 (CEST)
Message-Id: <20040419152341.C1AF9487D@zi025.glhnet.mhn.de>
Date: Mon, 19 Apr 2004 17:23:41 +0200 (CEST)
From: Simon Barner <barner@in.tum.de>
Reply-To: Simon Barner <barner@in.tum.de>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [printing] Fdescfs needs to be mounted on FreeBSD 5.x
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         65766
>Category:       docs
>Synopsis:       [printing] Fdescfs needs to be mounted on FreeBSD 5.x
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    blackend
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          doc-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Apr 19 08:30:19 PDT 2004
>Closed-Date:    Mon Jun 21 12:22:31 GMT 2004
>Last-Modified:  Mon Jun 21 12:22:31 GMT 2004
>Originator:     Simon Barner
>Release:        FreeBSD 5.2.1-RELEASE-p5 i386
>Organization:
>Environment:
System: FreeBSD zi025.glhnet.mhn.de 5.2.1-RELEASE-p5 FreeBSD 5.2.1-RELEASE-p5 #0: Sat Apr 17 12:06:11 CEST 2004 toor@zi025.glhnet.mhn.de:/usr/src/sys/i386/compile/KISTE i386

>Description:

The Handbook, Chapter 11, does not mention that you have to mount
fdescfs in order to use the example filter script (otherwise printing
does not work).

handbook/printing-advanced.html
 -> 11.4.1.3 Simulating PostScript on Non PostScript Printers

>How-To-Repeat:

Print w/o having that file system mounted. Enable logging in
/etc/printcap

:lf=/var/log/myprinter.log:

You will see the following error message:

Error: /invalidfileaccess in --.outputpage--
Operand stack:
   1   true
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval-
-   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   fa
lse   1   %stopped_push   1   3   %oparray_pop   1   3   %oparray_pop   1   3   
%oparray_pop   1   3   %oparray_pop   .runexec2   --nostringval--   --nostringva
l--   --nostringval--   2   %stopped_push   --nostringval--   0   4   %oparray_p
op   --nostringval--   --nostringval--   --nostringval--   --nostringval--
Dictionary stack:
   --dict:1059/1123(ro)(G)--   --dict:0/20(G)--   --dict:75/200(L)--   --dict:10
6/300(L)--
Current allocation mode is local
Last OS error: 45
GNU Ghostscript 7.07: Unrecoverable error, exit code 1

>Fix:

The following line in /etc/fstab

fdescfs /dev/fd fdescfs rw 0 0

and a mount /dev/fd made my printer work.

Furthermore I'd like to add that I had to remove the following line from
the ifhp example filter:

printf "\033&k2G" || exit 2
(I am using an Epson Stylus Color 740 via the stcolor driver, GNU
Ghostscript 7.07).
>Release-Note:
>Audit-Trail:

From: Marc Fonvieille <blackend@FreeBSD.org>
To: Simon Barner <barner@in.tum.de>
Cc: FreeBSD-gnats-submit@FreeBSD.org
Subject: Re: docs/65766: [printing] Fdescfs needs to be mounted on FreeBSD 5.x
Date: Mon, 19 Apr 2004 18:46:20 +0200

 On Mon, Apr 19, 2004 at 05:23:41PM +0200, Simon Barner wrote:
 > 
 > >Fix:
 > 
 > The following line in /etc/fstab
 > 
 > fdescfs /dev/fd fdescfs rw 0 0
 > 
 > and a mount /dev/fd made my printer work.
 >
 [...]
 
 Could you try this script:
 
 #!/bin/sh
 
 printf "\033&k2G" || exit 2
 
 IFS="" read -r first_line
 first_two_chars=`expr "$first_line" : '\(..\)'`
 
 case "${first_two_chars}" in
 \%\!*)
 	/usr/local/bin/gs -dSAFER -dNOPAUSE -q -sDEVICE=djet500 \
 	-sOutputFile=- - && exit 0
 	;;
 *)
 	echo "$first_line" && cat && printf "\033&l0H" && exit 0
 	;;
 esac
 
 exit 2
 
 You will have to comment the 2nd line if you use an Epson printer (it's
 your case) and don't forget to use the right device for -sDEVICE.
 
 > Furthermore I'd like to add that I had to remove the following line from
 > the ifhp example filter:
 > 
 > printf "\033&k2G" || exit 2
 > (I am using an Epson Stylus Color 740 via the stcolor driver, GNU
 > Ghostscript 7.07).
 
 It's normal this line is for HP printers
 
 Marc

From: Simon Barner <barner@in.tum.de>
To: Marc Fonvieille <blackend@FreeBSD.org>
Cc: FreeBSD-gnats-submit@FreeBSD.org
Subject: Re: docs/65766: [printing] Fdescfs needs to be mounted on FreeBSD 5.x
Date: Mon, 19 Apr 2004 19:42:51 +0200

 Marc Fonvieille wrote:
 > Could you try this script:
 
 [...]
 
 Thanks, that works nicely (without fdescfs).
 
 > You will have to comment the 2nd line if you use an Epson printer (it's
 > your case) and don't forget to use the right device for -sDEVICE.
 > 
 > > Furthermore I'd like to add that I had to remove the following line from
 > > the ifhp example filter:
 > > 
 > > printf "\033&k2G" || exit 2
 > > (I am using an Epson Stylus Color 740 via the stcolor driver, GNU
 > > Ghostscript 7.07).
 > 
 > It's normal this line is for HP printers
 
 Perhaps this could be mentioned in the handbook?
 
 Simon

From: Simon Barner <barner@in.tum.de>
To: Marc Fonvieille <blackend@FreeBSD.org>
Cc: FreeBSD-gnats-submit@FreeBSD.org
Subject: Re: docs/65766: [printing] Fdescfs needs to be mounted on FreeBSD 5.x
Date: Mon, 19 Apr 2004 20:07:38 +0200

 --xB0nW4MQa6jZONgY
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable
 
 > #!/bin/sh
 >=20
 > printf "\033&k2G" || exit 2
 >=20
 > IFS=3D"" read -r first_line
 > first_two_chars=3D`expr "$first_line" : '\(..\)'`
 >=20
 > case "${first_two_chars}" in
 > \%\!*)
 > 	/usr/local/bin/gs -dSAFER -dNOPAUSE -q -sDEVICE=3Ddjet500 \
 > 	-sOutputFile=3D- - && exit 0
 > 	;;
 > *)
 > 	echo "$first_line" && cat && printf "\033&l0H" && exit 0
 > 	;;
 > esac
 >=20
 > exit 2
 
 I just had another look at the original script:
 
     #
     #  It is PostScript; use Ghostscript to scan-convert and print it.
     #
     #  Note that PostScript files are actually interpreted programs,
     #  and those programs are allowed to write to stdout, which will
     #  mess up the printed output.  So, we redirect stdout to stderr
     #  and then make descriptor 3 go to stdout, and have Ghostscript
     #  write its output there.  Exercise for the clever reader:
     #  capture the stderr output from Ghostscript and mail it back to
     #  the user originating the print job.
     #
 
 Your script does not pay attention to the fact that postscript program
 might mess up stdout, so I guess there is no way around the redirection
 to fd 3.
 
 Is there anything bad about having fdecsfs mounted?
 
 --xB0nW4MQa6jZONgY
 Content-Type: application/pgp-signature; name="signature.asc"
 Content-Description: Digital signature
 Content-Disposition: inline
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.2.4 (FreeBSD)
 
 iD8DBQFAhBVqCkn+/eutqCoRAoM5AJ44aJrG3LC4ycFz8eCUKIhwVKzHOwCgtPzB
 3ZThA3kgl2c90NaYJyBaD3k=
 =pQ3t
 -----END PGP SIGNATURE-----
 
 --xB0nW4MQa6jZONgY--
Responsible-Changed-From-To: freebsd-doc->blackend 
Responsible-Changed-By: blackend 
Responsible-Changed-When: Sun Apr 25 05:45:29 PDT 2004 
Responsible-Changed-Why:  
I'll take care of this one. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=65766 
State-Changed-From-To: open->closed 
State-Changed-By: blackend 
State-Changed-When: Mon Jun 21 12:21:41 GMT 2004 
State-Changed-Why:  
I updated the Handbook example.  Thanks. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=65766 
>Unformatted:
