From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8283 invoked by alias); 7 Mar 2013 06:39:47 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 31124 Received: (qmail 5234 invoked from network); 7 Mar 2013 06:39:46 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at linux.vnet.ibm.com does not designate permitted sender hosts) Date: Thu, 7 Mar 2013 14:28:36 +0800 From: Han Pingtian To: zsh-workers@zsh.org Subject: Re: coproc fd leak leading to possible deadlock Message-ID: <20130307062836.GA2676@localhost.localdomain> References: <20130306225341.GA12150@chaz.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130306225341.GA12150@chaz.gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: No X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13030706-5806-0000-0000-0000203B07DC On Wed, Mar 06, 2013 at 10:53:41PM +0000, Stephane Chazelas wrote: > Side question: is it possible to close any of the coproc pipes? > >&p- or <&p- don't work. > > If I run another coproc, that closes the current one AFAICT, so I > can do: > > coproc cmd > exec {i}<&p {o}>&p > coproc : > exec {i}<&- Interesting, I'm glad to know this. Thanks. > > as a work around, but I thought there should be a simpler way. > > Even when the coproc has terminated, the fds are not closed. > > sc% coproc sleep 10 > [1] 14594 > sc% lsof -ad11-20 -p $$ > COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME > zsh 12148 chazelas 11r FIFO 0,8 0t0 295967 pipe > zsh 12148 chazelas 14w FIFO 0,8 0t0 295968 pipe > sc% > [1] + done sleep 10 > sc% lsof -ad11-20 -p $$ > COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME > zsh 12148 chazelas 11r FIFO 0,8 0t0 295967 pipe > zsh 12148 chazelas 14w FIFO 0,8 0t0 295968 pipe > > Having said that, zsh coproc is a lot more usable that bash's or ksh's. At > least the issues can easily be worked around. > > -- > Stephane