Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!ASC.SLB.COM!steve From: steve@ASC.SLB.COM Newsgroups: gnu.emacs.bug Subject: Bug (and patch) in process management Message-ID: <8912061840.AA02214.steve@argon.ASC.SLB.COM> Date: 6 Dec 89 18:40:41 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 104 The following bug has been observed in GNU Emacs version 18.54, on various SUN 3 models (including 3/60 and 3/75) running SUN OS4, with Lucid Common Lisp 3.0 executing as an inferior lisp process. When the Lucid stepper is used, the lisp process will stop with the message "Process lisp stopped (signal)." It turns out to be impossible to restart the lisp process with (continue-process (get-process "lisp")). This typically occurs within the first 20 or 30 commands given to the stepper. We've patched the file src/process.c to fix this. The basis of the fix is the observation that a read call on the pipe connecting the inferior lisp process with Emacs returns with error EWOULDBLOCK, even though a previous select call has indicated that there is data in the pipe. The diff is included below. So it appears that SUN OS4 is the culprit here. The error has not been observed on the SUN4. Thanks for your attention Steve Kaufman Schlumberger Austin Systems Center steve@ASC.SLB.COM Diff File (process.c_orig is the copy of process.c in dist-18.54, process.c is our patched version) argon[steve]6> diff /usr/local/emacs/src/process.c_orig /usr/local/emacs/src/process.c 0a1 > 1289a1291 > int n; 1485c1487 < /* It has ceased to be a command channel! */ --- > /* It has ceased to be a command channel! */ 1498,1501c1500,1502 < < if (read_process_output (proc, channel) > 0) < { < if (do_display) --- > if (n = read_process_output (proc, channel) > 0) > if (n > 0) { > if (do_display) { 1502a1504,1505 > } > break; 1504,1505c1507,1514 < else < { --- > /* The next test is here because the pipe may be empty > even after the select call has returned. If so, simply > break out of the loop to call select again. */ > #ifdef BSD > else if ((n == -1) && (errno == EWOULDBLOCK)) > break; > #endif BSD > else { 1510,1520c1519,1529 < /* < * With ptys: when the parent process of a pty exits we are notified, < * just as we would be with any of our other children. After the process < * exits, select() will indicate that we can read the channel. When we < * do this, read() returns 0. Upon receiving this, we close the channel. < * < * For external channels, when the peer closes the connection, select() < * will indicate that we can read the channel. When we do this, read() < * returns -1 with errno = ECONNRESET. Since we never get notified of < * this via wait3(), we must explictly mark the process as having exited. < */ --- > /* > * With ptys: when the parent process of a pty exits we are notified, > * just as we would be with any of our other children. After the process > * exits, select() will indicate that we can read the channel. When we > * do this, read() returns 0. Upon receiving this, we close the channel. > * > * For external channels, when the peer closes the connection, select() > * will indicate that we can read the channel. When we do this, read() > * returns -1 with errno = ECONNRESET. Since we never get notified of > * this via wait3(), we must explictly mark the process as having exited. > */ 1565c1574 < if (nchars <= 0) return 0; --- > if (nchars <= 0) return nchars; /* 0; */ 1689a1699,1700 > /* for debug */ > fprintf(stderr, "%d %s", count, buf) 2085,2086c2096,2097 < if ((XFASTINT (p->flags) & PROC_STATUS) == SIGNALED) < if (delete_exited_processes) --- > if ((XFASTINT (p->flags) & PROC_STATUS) == SIGNALED) { > if (delete_exited_processes) { 2087a2099 > } 2089a2102 > }