Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!mcnc!philabs!prls!mips!dce From: dce@mips.UUCP (David Elliott) Newsgroups: comp.unix.questions,comp.unix.wizards,comp.bugs.4bsd Subject: Re: Running stdin/out through a pipe to a child process Message-ID: <145@quacky.mips.UUCP> Date: Mon, 19-Jan-87 10:43:50 EST Article-I.D.: quacky.145 Posted: Mon Jan 19 10:43:50 1987 Date-Received: Thu, 22-Jan-87 03:44:21 EST References: <136@cogent.UUCP> <3112@rsch.WISC.EDU> <423@bobkat.UUCP> Reply-To: dce@quacky.UUCP (David Elliott) Distribution: world Organization: MIPS Computer Systems, Sunnyvale, CA Lines: 30 Summary: Bug in 4.[23]BSD with closing pipes Xref: mnetor comp.unix.questions:787 comp.unix.wizards:675 comp.bugs.4bsd:140 With all of this discussion about pipes, I thought I'd bring up the subject of a (4.[23]BSD) bug involving closing two pipes in succession: 1. A pipe is opened, written to, closed, and the child process is waited on. After termination, this is done again. All goes as expected. 2. Two pipes are opened and written to. Next, both pipes are closed. Finally, each child process is waited for. All goes as expected, except that I find it odd that the second child is found by wait() first. This really isn't the problem anyway. 3. Two pipes are opened and written two. Afterwards, each pipe is closed and the child process waited for (that is, pipe 1 is closed and child 1 is waited for and then pipe 2 is closed and child 2 is waited for). In this case, the first wait() blocks, and the first child never terminates except when the parent does. I have reduced these 3 cases as much as possible by inlining the code for popen() and pclose() and getting rid of the stdio code used by them (stdio exists only to print error messages in the programs). The result is a set of programs that directly call the system calls involved. If anyone would like to work on this problem, I can send out copies of these programs (the whole deal is about 8K of source, but I didn't want to clutter up the net). -- David Elliott UUCP: {decvax,ucbvax,ihnp4}!decwrl!mips!dce, DDD: 408-720-1700