[news.software.b] Rn and ^Z on IRIX

reggers@ria.ccs.uwo.ca (Reg Quinton) (11/05/90)

I'm having problems getting rn (actually rrn) to handle ^Z properly
on an IRIX machine. If I stop rn with a ^Z, and then later bring
it up with an fg command I get:
----
[12:21pm grafxa] fg
./rn
rn read error: Interrupted system call

Caught an internal error--.newsrc restored
----
has anyone else seen this problem?

jgreco@archimedes.math.uwm.edu (Joe Greco) (11/06/90)

In news.software.nntp article <1990Nov5.121957@ria.ccs.uwo.ca>, reggers@ria.ccs.uwo.ca (Reg Quinton) wrote:
:[12:21pm grafxa] fg
:./rn
:rn read error: Interrupted system call
:
:Caught an internal error--.newsrc restored
:----
:has anyone else seen this problem?

Yes, quite infrequently.  It seems to happen when rn is displaying an
article and you don't wait for a prompt to type ^Z....  I assume that the ^Z
catches a read call from the NNTP server in the middle and causes an
Interrupted system call.  I have not verified this within the source code.

Solution (or apparent solution, I have no problems if I am following my own
advice): don't use ^Z unless you're at a prompt.

Your mileage may be worse than mine.

... Joe

-------------------------------------------------------------------------------
Joe Greco - University of Wisconsin, Milwaukee - Department of Mathematics
jgreco@archimedes.math.uwm.edu		USnail: Joe Greco
Voice: 414/321-6184				9905 W. Montana Ave.
Data:  414/321-9287 (Happy Hacker's BBS) 	West Allis, WI  53227-3329
ICBM:  43 05 20 N 87 53 10 W
#include <witty_and_humorous_saying.h>
Disclaimer: I don't speak for the Math Department, the University, or myself.

reggers@ria.ccs.uwo.ca (Reg Quinton) (11/06/90)

In article <1990Nov5.121957@ria.ccs.uwo.ca>, reggers@ria.ccs.uwo.ca (Reg
Quinton) writes:
|> I'm having problems getting rn (actually rrn) to handle ^Z properly
|> on an IRIX machine. If I stop rn with a ^Z, and then later bring
|> it up with an fg command I get:
|> ----
|> [12:21pm grafxa] fg
|> ./rn
|> rn read error: Interrupted system call
|> 
|> Caught an internal error--.newsrc restored
|> ----

I don't know if this is fixed in patch 48 (I see that's coming out as I
write). However, here's the problem and solution. On some machines the
^Z,
fg sequence can give you interrupted a read operation. This returns an
errno == EINTR. The code in term.c should be modified as follows to try
the read again if such an error occurs.

---

/* get a character into a buffer */

void
getcmd(whatbuf)
register char *whatbuf;
{
 ....
    for (;;) {
	int_count = 0;
	errno = 0;
	if (read_tty(whatbuf,1) < 0)
	    /* on return from ^Z, try again */
            if (errno == EINTR) continue;
            else
	    if (!errno)
	        errno = EINTR;
	    else {
	    perror(readerr);
	    sig_catcher(0);
	}