[net.bugs.4bsd] troff/nroff/ditroff end-macro bug

grandi@noao.UUCP (Steve Grandi) (10/16/86)

Subject: troff/nroff prematurely interrupts end-macro processing
Index:	/usr/src/usr.bin/troff/n7.c 4.3BSD

Description: 
	(The following bug-report and fix are from D'Anne Thompson)

	End-macro processing in troff/nroff/ditroff is being prematurely
interrupted.  Only a single page of text was being ejected upon reaching the
end of input text.  This was the case even when there was diverted material,
notably a floating keep, that should be floated to the top of another new
page.  After investigation it was found that only the current page at the
time of reaching the end-macro was being completed, any additional pages that
might be due to the end-macro processing itself were being suppressed.

Repeat-By:  
	Run the following through troff/nroff using -me

.fo ''Footer''
.pp
A normal paragraph.
A normal paragraph.
A normal paragraph.
A normal paragraph.
A normal paragraph.
A normal paragraph.
A normal paragraph.
A normal paragraph.
.sp 7.0i
.(z
A Floating keep.
It should float to the top of the 
following page.

This should be the second page output, if end-macro
processing is working correctly.

She sells sea shells by the sea shore.
.)z
.pp
A normal paragraph.


Fix:
	file n7.c, subroutine newline()

*** n7.c.ORIG	Thu Aug  5 14:53:14 1982
--- n7.c	Tue Sep 16 16:01:51 1986
***************
*** 423,429 ****
  nl1:
  	ejf = dip->hnl = v.nl = 0;
  	ejl = frame;
! 	if(donef){
  		if((!nc && !wch) || ndone)done1(0);
  		ndone++;
  		donef = 0;
--- 423,429 ----
  nl1:
  	ejf = dip->hnl = v.nl = 0;
  	ejl = frame;
! 	if(donef == 1){
  		if((!nc && !wch) || ndone)done1(0);
  		ndone++;
  		donef = 0;
-- 
Steve Grandi, National Optical Astronomy Observatories, Tucson, AZ, 602-325-9228
{arizona,decvax,hao,ihnp4,seismo}!noao!grandi  grandi%draco@Hamlet.Caltech.Edu

edmoy@opal.berkeley.edu (10/16/86)

Steve & D'Anne,

It's amazing that it seems that you and I have uncovered and fixed this
bug at about the same time.  Myself, I wasn't sure of any possible side-
effects this might cause, as even though I've been hacking with troff
the last almost three years, I'm still much afraid of fixing something and
breaking something else.  It's comforting to know that someone else has come
up independently with the same solution.  Thanks.

Edward Moy
Academic Computing Services
University of California
Berkeley, CA  94720

edmoy@ucbopal.Berkeley.EDU
ucbvax!opal!edmoy