From sysseh@devetir.qld.gov.au  Tue Sep 26 00:55:37 1995
Received: from bunyip.cc.uq.oz.au (pp@bunyip.cc.uq.oz.au [130.102.2.1])
          by freefall.freebsd.org (8.6.12/8.6.6) with SMTP id AAA23040
          for <FreeBSD-gnats-submit@freebsd.org>; Tue, 26 Sep 1995 00:54:10 -0700
Received: from cc.uq.oz.au by bunyip.cc.uq.oz.au 
          id <19003-0@bunyip.cc.uq.oz.au>; Tue, 26 Sep 1995 17:52:44 +1000
Received: from netfl15a.devetir.qld.gov.au 
          by pandora.devetir.qld.gov.au (8.6.10/DEVETIR-E0.3a) with ESMTP 
          id RAA24442 for <FreeBSD-gnats-submit@freebsd.org>;
          Tue, 26 Sep 1995 17:57:52 +1000
Received: from localhost by netfl15a.devetir.qld.gov.au (8.6.8.1/DEVETIR-0.1) 
          id IAA07164 for <FreeBSD-gnats-submit@freebsd.org>;
          Tue, 26 Sep 1995 08:00:22 GMT
Message-Id: <199509260800.IAA07164@netfl15a.devetir.qld.gov.au>
Date: Tue, 26 Sep 1995 18:00:21 +1000
From: Stephen Hocking <sysseh@devetir.qld.gov.au>
Sender: sysseh@devetir.qld.gov.au
To: FreeBSD-gnats-submit@freebsd.org
Subject: lpd does not handle output filters correctly

>Number:         739
>Category:       bin
>Synopsis:       Some problems when an output filter reads all input before
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Sep 26 01:00:02 PDT 1995
>Closed-Date:    Mon Dec 9 09:29:29 PST 1996
>Last-Modified:  Mon Dec  9 09:29:52 PST 1996
>Originator:     Stephen Hocking
>Release:        FreeBSD 2.2-CURRENT i386
>Organization:
DEVETIR
>Environment:

	2.2 current

>Description:

	When using an output filter that reads all of its input before
	commencing operation, lpd assumes that the printing is finished and
	starts another job from that queue. This means that output can be
	interleaved as each instance of the output filter finishes processing.

>How-To-Repeat:

	Create an output filter that reads all of its standard input before
	printing, eg

	cat > /tmp/foo.$$
	some_random_data_fiddling
	cat /tmp/foo.$$

	Send off lots of jobs to that particular queue and watch your
	stuff interleave.
>Fix:
	
	Find the following diff to correct the problem for printjob.c

*** printjob.c.dist	Fri Sep  8 14:21:53 1995
- --- printjob.c	Fri Sep  8 14:23:54 1995
***************
*** 272,277 ****
- --- 272,279 ----
  				(void) write(ofd, TR, strlen(TR));
  		}
  		(void) unlink(tempfile);
+ 		close(ofd);		/* give ofilter an EOF indicator */
+ 		(void)wait((int *)0);	/* wait until ofilter finished */
  		exit(0);
  	}
  	goto again;





        I do not speak for the Worker's Compensation Board of Queensland -
                     They don't pay me enough for that!

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: scrappy 
State-Changed-When: Mon Oct 21 23:11:47 PDT 1996 
State-Changed-Why:  

Dust off the cobwebs - Confirm Status 
State-Changed-From-To: feedback->closed 
State-Changed-By: mpp 
State-Changed-When: Mon Dec 9 09:29:29 PST 1996 
State-Changed-Why:  
Fixed in -current. 
>Unformatted:
starting.
