lpr loses last part of output

Ian Donaldson munnari!chudich.co.rmit.oz.au!rcodi at uunet.uu.net
Mon May 8 23:52:03 AEST 1989


> We have a Printronix P6040L printer hooked up to the ALM-2 parallel port
> on a Sun 3/260 running SunOS 4.0.1.  About half the times that lpr is used
> with plain text, the very last part of the output is mysteriously
> truncated.  The problem is reproducible with certain files.  Has anyone
> else run into this one---and fixed it?  There doesn't seem to be anything
> special in /etc/printcap that needs to be set, but perhaps I'm missing
> something.  

There is a bug in a lot of old BSD tty drivers in that the last close on
the device drops DTR before the last data goes out.  This means that if
DCD is connected to DTR (some how) then the last lot of data might be
flushed down the toilet.

In short, the icky method of sticking out extra blanks on the output at
the end works fine.  Another approach is to sleep(4) after you've written
the last data to allow it time to go out.  For lpr, this means you need
your own filter that does this, to replace "lpf".

The fix in the tty driver (at least 4.2bsd and SunOS 3.5 I suspect) is to
reorder the the statements that do the ttyflush() in the code that detects
the drop in DCD.  In 4.3bsd this is fixed in ttymodem() (this is all from
memory, and a bit hazy at that...)

Anyway, I *know* the bug exists in SunOS 3.3 thru 3.5 and Vax 4.2bsd.  Not
sure about other SunOS's.  The bug doesn't exist in Vax 4.3bsd however.

Ian D



More information about the Comp.sys.sun mailing list