Subject: bin/17399: lpd's treatment of filter exit codes undocumented
To: None <>
From: None <>
List: netbsd-bugs
Date: 06/25/2002 22:48:03
>Number:         17399
>Category:       bin
>Synopsis:       lpd's treatment of filter exit codes and lock file file mode undocumented
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          doc-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jun 25 15:41:00 PDT 2002
>Release:        NetBSD 1.5ZC
System: NetBSD ni 1.5ZC NetBSD 1.5ZC (ni) #3: Wed May 15 21:44:21 GMT 2002 root@ni:/home/src/sys/arch/i386/compile/ni i386
Architecture: i386
Machine: i386
	not sure in which page this belongs, lpd(8) or printcap(5).  printcap
	seems to have most of the useful info about filters.

	anyway, lpd's treatment of filter exit codes and the mode of the lock
	file is undocumented.  both are useful for a filter signal its status
	back to lpd, such as "printer is completely frobbed, dont retry and
	clean every job in the queue".

	lpd appears to treat filter exit codes as follows in printjob.c:print():
	0 == success (OK)
	1 == the job is restarted once, then gives up and sends email to the
	     user (REPRINT)
	2 == lpd just gives up (ERROR)
	n == lpd gives up and sends email (FILTERERR)

	and lock file modes as:
	S_IXUSR == stop printing before next job, leaving the queue disabled
	S_IXOTH == rebuild the queue

	here's an attempt; no doubt this requires some swabbing.  i couldnt
	figure out what was causing bizarre characters in the exit(1)

Index: printcap.5
RCS file: /cvsroot/sharesrc/share/man/man5/printcap.5,v
retrieving revision 1.12
diff -r1.12 printcap.5
> .Pp
> Filters can communicate errors to lpd by their exit code and by modifying
> the mode of the spool lock file as follows:
> .Bl -column "Exit-code" Description
> .Sy "Exit-code"	Description
> .It 0	Success.
> .It 1	An attempt is made to reprint the job and mail is sent if it fails.
> .It 2	\c
> .Xr lpd 8
> silently discards the job.
> .It n	\c
> .Xr lpd 8
> discards the job and mail is sent.
> .El
> .Bl -column "lock mode" Description
> .Sy "lock mode"	Description
> .It u+x	Stop printing and leave queue disabled (S_IXUSR).
> .It o+x	Rebuild the queue (S_IXOTH).
> .El