[net.bugs.4bsd] shell escapes from "more" ... bug found/fixed

boyd@basservax.SUN (Boyd Roberts) (01/18/84)

When more is being used as a filter in a pipeline the
situation can arise that more will not wait for a shell
escape from it to complete.  This occurs when a process in
the pipeline (one of more's children) terminates and the
wait returns on this child instead of the shell escape.
This certainly happens at "post-C-shell" sites.

The bug is in "execute" and arises from sloppy assumptions
about who the "wait" will return on.

"Execute" should do this:

    switch (pid = fork())
    {

    case -1:
	...

    case 0:
	...

    default:
	while ((i = wait((int *)0)) != pid && i != -1)
	    ;
    }

Now why it did this I don't know:

 	while ((id = fork ()) < 0)
 	    sleep (5);

But I suppose he who persists...

More is a horrible thing, "execute" yes, execute the author.

---
From the schooner glass of Boyd Roberts (Ahh Fosters...)
{decvax,mh3bc1}!mulga!boyd:basservax