[net.news.b] fork problem in inews.c?

larry (08/07/82)

Seems that I stumbled over this once before when I first brought up a
copy of version 2.8 --  If you do not have $NAME set, or a ".name" file,
inews is supposed to ask you for your name [some versions get it from
the password file].  However, in version 2.9, after printing the prompt
for your name, inews trips over line 307 (after a fork) and exits you
back to the shell, leaving the "background" inews running.  This line
was changed in the update package --question is why??  Seems to work
much better the way it was!  Can anybody give me the insight as to why
this line changed?  Now that I think about it, I'm more confused.. why
fork and then let the child exit?  Here's the code:

out:
	/* Determine input. */
	if (mode != PROC)
		input();

	if (tty) {
		i = fork();
		if (i != 0)		/* used to be (i == 0) in 2.8 */
			exit(0);
	}

	/* Do the actual insertion. */
	insert();

Does the "if (tty)" line need something else tested?  Makes more sense,
I think.

	Thanks in advance for any light you can shed on this.


		Larry Marek
		 Bell Labs
		  Naperville

mark (08/08/82)

The change in 2.9 was a crucial bug fix - otherwise, inews would
immediately fork into the background if you invoked it directly, and it
and your shell would fight for input from your tty.  In any case, the
intent is for the parent to exit, leaving the child to enter the article
in the background, making response appear faster to the user.

There are a number of problems with forking.  There may be a full name
problem - that case isn't very well tested since all sites here have
the name in the gecos field.  There are also problems with recordings
for control messages (inews -C) and the mail (recnews) interface.

	Mark