From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3049 invoked by alias); 14 Oct 2013 13:48:58 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 18026 Received: (qmail 16544 invoked from network); 14 Oct 2013 13:48:43 -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, SPF_HELO_PASS autolearn=ham version=3.3.2 X-AuditID: cbfec7f4-b7f0a6d000007b1b-28-525bf637e33e Date: Mon, 14 Oct 2013 14:48:38 +0100 From: Peter Stephenson To: zsh-users@zsh.org Subject: Re: process substitution bug with set -e? Message-id: <20131014144838.6ec034dd@pwslap01u.europe.root.pri> In-reply-to: <20131014124126.GA31070@ypig.lip.ens-lyon.fr> References: <20131014124126.GA31070@ypig.lip.ens-lyon.fr> Organization: Samsung Cambridge Solution Centre X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuphluLIzCtJLcpLzFFi42I5/e/4VV3zb9FBBkvnWljsOLmS0YHRY9XB D0wBjFFcNimpOZllqUX6dglcGTsOeha84aqYvf8eSwPjYY4uRk4OCQETiWtrfjJC2GISF+6t Z+ti5OIQEljKKPFsey87lMMksf/FcSaQKhYBVYnJs3awgthsAoYSUzfNBusWERCVWL5iMzuI LSxgJPHxUxeYzStgL9Gw6ihYL6eAlcTu2S/B6oUELCX+XfsHFucX0Je4+vcTE8QV9hIzr5xh hOgVlPgx+R4LiM0soCWxeVsTK4QtL7F5zVvmCYwCs5CUzUJSNgtJ2QJG5lWMoqmlyQXFSem5 hnrFibnFpXnpesn5uZsYISH4ZQfj4mNWhxgFOBiVeHgFnKKDhFgTy4orcw8xSnAwK4nw5r4F CvGmJFZWpRblxxeV5qQWH2Jk4uCUamCc8omHLYore+KliFDWPWdNo16/EIiKfM5pZqgTf8eK rX+X+3U75jVt6hE2JkLGLatjPspN//8kpnzlctZF0w5u21LJ+kDozr19po/WH1/0IPyDwS3X fP++mwd1t/SoL/3QKzYxx3pytxnLYY+/0w3XnpNpX3979hLp1zcmOD02vaMvnJP+zbZBiaU4 I9FQi7moOBEAHXrwGR8CAAA= On Mon, 14 Oct 2013 14:41:27 +0200 Vincent Lefevre wrote: > #!/usr/bin/env zsh > set -e > { /bin/cp } 2>>(sleep 1; cat -n) > > Due to /bin/cp failure and the "set -e", the parent shell exits > immediately, without waiting for the extra processes: > > ypig% ./zsh-procsubst > ypig% 1 /bin/cp: missing file operand > 2 Try '/bin/cp --help' for more information. > > (tested under Debian/unstable). > > Shouldn't the parent shell wait in this case? I may be thinking too naively here, but... It's not clear to me this is wrong, anyway (apart from the lack of documentation). You're in a non-interactive shell with no job control (it's possible to mix job control with ERR_EXIT although it seems rather unnatural). So the shell has no way cleanly to kill jobs associated with it. So it would have to wait until the sleep has finished (or any other process, however long they took), and it doesn't necessarily know they're going to exit --- which would be a bug in the script, but if you've got ERR_EXIT set you probably want to avoid tickling script bugs when that's in operation. I think it could be made to wait, but there's a reasonable argument that as it's already detected the failure and you've asked it to exit on failure it should just do that. I certainly don't claim this is a definitive answer. pws