Brian Mays <[EMAIL PROTECTED]> typed:
:Another message bug report received by the Debian Bug Tracking System:
:> From: Marius Gedminas <[EMAIL PROTECTED]>
:> To: Debian Bug Tracking System <[EMAIL PROTECTED]>
:> Subject: rxvt fails to exit after the shell terminates and starts eating CPU
:> Today I noticed that after starting rxvt and exiting from the shell,
:> rxvt doesn't exit but starts eating the CPU instead. ltrace on the pid
:> shows that it is repeatedly calling
:> strace repeatedly shows
:> ioctl(3, 0x541b, [0]) = 0
:> select(5, [3 4], NULL, NULL, NULL) = 1 (in [4])
:> read(4, 0x805cd80, 8192) = -1 EIO (Input/output error)
I had a feeling there was a reason we couldn't check for EAGAIN here (on
some platform) but since it's not documented I've put it in. This should
allow an exit if we don't receive proper child signals.
Two patches follow - first is for 2.6.4, second is for 2.7.8+
Regards,
Geoff
Index: command.c
===================================================================
RCS file: /cvsroot/rxvt/rxvt/src/command.c,v
retrieving revision 1.85.2.35
diff -u -r1.85.2.35 command.c
--- command.c 2 Nov 2001 00:18:57 -0000 1.85.2.35
+++ command.c 9 Apr 2002 01:47:05 -0000
@@ -1670,8 +1670,14 @@
cmdbuf_ptr = cmdbuf_endp = cmdbuf_base;
for (count = BUFSIZ; count; count -= n, cmdbuf_endp += n)
- if ((n = read(cmd_fd, cmdbuf_endp, count)) <= 0)
+ if ((n = read(cmd_fd, cmdbuf_endp, count)) > 0)
+ continue;
+ else if (n == 0 || (n < 0 && errno == EAGAIN))
break;
+ else {
+ clean_exit();
+ exit(1); /* bad order of events? */
+ }
if (count != BUFSIZ) /* some characters read in */
return (*cmdbuf_ptr++);
}
Index: command.c
===================================================================
RCS file: /cvsroot/rxvt/rxvt/src/command.c,v
retrieving revision 1.248
diff -u -r1.248 command.c
--- command.c 9 Apr 2002 00:49:22 -0000 1.248
+++ command.c 9 Apr 2002 01:41:54 -0000
@@ -746,8 +746,14 @@
h->cmdbuf_ptr = h->cmdbuf_endp = h->cmdbuf_base;
for (count = BUFSIZ; count; count -= n, h->cmdbuf_endp += n)
- if ((n = read(r->cmd_fd, h->cmdbuf_endp, count)) <= 0)
+ if ((n = read(r->cmd_fd, h->cmdbuf_endp, count)) > 0)
+ continue;
+ else if (n == 0 || (n < 0 && errno == EAGAIN))
break;
+ else {
+ rxvt_clean_exit();
+ exit(EXIT_FAILURE); /* bad order of events? */
+ }
if (count != BUFSIZ) /* some characters read in */
return *h->cmdbuf_ptr++;
}
--
Geoff Wing : <[EMAIL PROTECTED]>
Rxvt Stuff : <[EMAIL PROTECTED]>
Zsh Stuff : <[EMAIL PROTECTED]>