On Mon, Apr 09, 2001 at 06:27:20PM -0500, Robert Hentosh wrote:
> On Mon, Apr 09, 2001 at 02:52:41PM -0500, Robert Hentosh wrote:
> > I have been playing with aolserver on OpenBSD 2.8. aolserver 3.3.1
> > now compiles cleanly on OpenBSD. And searching through the mailling
> > lists the only other problem seems to be an issue with tcl exec command.
> >
> > I have tried an exec from a tcl script and from an ADP and have
> > confirmed the problem.
> >
> > an ADP with the following in it:
> >
> > <% ps_puts [exec /bin/ls] %>
> >
> > fails with the following in the log:
> >
> > Error: error reading output from command: interrupted system call
> > while executing
> > "exec /bin/ls"
> >
:: snip ::
> Using ktrace on the nsd8x process and it seems that the read() from the
> pipe to the fork'd process is receiving SIGCHLD:
:: snip ::
> So it looks like to me that the read() at line 953 in tclUnixPipe.c is
> getting the SIGCHLD on the second read() after it has obtained the
> program output. I am not sure what the proper solution should be.
>
> Suggestions?
I wrapped it in a loop and it seems to be working.
diff -u aolserver3_3_1/tcl8.3.2/unix/tclUnixPipe.c
aolserver3_3_1_patched/tcl8.3.2/unix/tclUnixPipe.c
--- aolserver3_3_1/tcl8.3.2/unix/tclUnixPipe.c Thu Aug 17 17:46:15 2000
+++ aolserver3_3_1_patched/tcl8.3.2/unix/tclUnixPipe.c Mon Apr 9 13:52:39 2001
@@ -949,13 +949,16 @@
* possible, if the channel is in blocking mode. If the channel is
* nonblocking, the read will never block.
*/
-
- bytesRead = read(GetFd(psPtr->inFile), buf, (size_t) toRead);
- if (bytesRead > -1) {
- return bytesRead;
+ while (1) {
+ bytesRead = read(GetFd(psPtr->inFile), buf, (size_t) toRead);
+ if (bytesRead > -1) {
+ return bytesRead;
+ }
+ if ( errno != EINTR ) {
+ *errorCodePtr = errno;
+ return -1;
+ }
}
- *errorCodePtr = errno;
- return -1;
}
^L
/*