Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Message-Id: <200111090005.QAA15761@gloworm.Stanford.EDU> To: cygwin AT cygwin DOT com cc: yergeau AT gloworm DOT Stanford DOT EDU Subject: 1.3.4: read on pipe setting errno=ECHILD Date: Thu, 08 Nov 2001 16:05:17 -0800 From: Dan Yergeau When I upgraded from 1.3.3 to 1.3.4 on W2K, I noticed tcsh's backquote substitution getting a little "random" (i.e. sometimes it would work, and sometimes an empty string would be substituted). I traced this randomness to the following fragment in tcsh's sh.glob.c:backeval() routine: do icnt = read(pvec[0], tibuf, BUFSIZE); while (icnt == -1 && errno == EINTR); if (icnt <= 0) { c = -1; break; } The "break" is out of a "gather characters from child process" loop, so the output of the child process is *sometimes* discarded. FWICT, 1.3.3 would always set errno=EINTR (I'm assuming that this is because the parent process receives a SIGCHILD before all of the data is available to the read). The above problem could be fixed by changing the "errno == EINTR" to "(errno == EINTR || errno == ECHILD)", but I can't find any documentation that a POSIX read() is permitted to set errno to ECHILD, so I don't think that this change is really justifiable. I just may not have access to the correct documentation on what errno values may be set to by read, so I'll defer judgment to the experts. Cheers, Dan -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/