From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14491 invoked by alias); 7 Oct 2013 09:25:39 -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: 31792 Received: (qmail 26452 invoked from network); 7 Oct 2013 09:25:34 -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: cbfec7f5-b7ef66d00000795a-db-52527e0ab20c Date: Mon, 07 Oct 2013 10:25:29 +0100 From: Peter Stephenson To: zsh-workers@zsh.org Subject: Re: No pipefail option? Message-id: <20131007102529.5354f342@pwslap01u.europe.root.pri> In-reply-to: <131006173621.ZM31831@torch.brasslantern.com> References: <20131005223159.25fea6a0@pws-pc.ntlworld.com> <131006173621.ZM31831@torch.brasslantern.com> 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/4NV2uuqAggwVtVhYHmx8yOTB6rDr4 gSmAMYrLJiU1J7MstUjfLoErY/usDYwF/3krNh8+x97AuIa7i5GDQ0LARGLbUuUuRk4gU0zi wr31bF2MXBxCAksZJX5PnMEE4SxnktjZvZ8RpIpFQFViy4k7rCA2m4ChxNRNs8HiIgLiEmfX nmcBsYUFFCQe/ZwFZvMK2Es0P1gCVs8pYCXx98IUMFtIYBOjxL39viA2v4C+xNW/n5ggrrCX mHnlDCNEr6DEj8n3wOYwC2hJbN7WxAphy0tsXvOWeQKjwCwkZbOQlM1CUraAkXkVo2hqaXJB cVJ6rpFecWJucWleul5yfu4mRkgIft3BuPSY1SFGAQ5GJR7eHfcDg4RYE8uKK3MPMUpwMCuJ 8F6qAwrxpiRWVqUW5ccXleakFh9iZOLglGpgzNyf9sZhys7wuenzP7ja3Zj6YkHZ3MK3ttvr hSxlPt1/3T2/8OK/+0diKzj+FP0u0lIR17h+9rTs4Z0rWTeKTGv68/TwDesdESlcz7rrj06d pplT8t9xwclGa3625Ys3X74iJD2pctbnJ/Usn9OeJKnzKMyQNP52RVS5e2XY2iNaM2Yne9hb JymxFGckGmoxFxUnAgBMddJ1HwIAAA== On Sun, 06 Oct 2013 17:36:21 -0700 Bart Schaefer wrote: > [>workers] > > On Oct 5, 10:31pm, Peter Stephenson wrote: > } > } Indeed, if $pipestatus is working as advertised, it really ought to be > } this simple... > > Unfortunately, $pipestatus is not working as advertised. Looks that this might not be fatal for the most typical uses of PIPEFAIL, since I suspect if you've got a loop at the end of the pipe processing the results in the main shell you'd typically detect errors at that point. > See this thread from 2011: > > http://www.zsh.org/mla/workers/2011/msg01394.html > > In particular > > http://www.zsh.org/mla/workers/2011/msg01396.html > http://www.zsh.org/mla/workers/2011/msg01470.html > http://www.zsh.org/mla/workers/2011/msg01475.html > http://www.zsh.org/mla/workers/2011/msg01476.html > > The patch mentined in msg01476 is here: > > http://www.zsh.org/mla/workers//2011/msg01472.html > > But it didn't resolve the issue, so I never committed it. > > The long and short of it is that pipestatus only works reliably when > all the commands in the pipeline are external programs. It's not clear to me if (i) the problem is only relevant to the final stage in the pipeline (as we fork for others anyway) (ii) you need a complex command rather than a simple builtin to get confused, but presumably a complex command might be a function as there's nothing special about jobs run from inside a function (they are not encapsulated as far as job control is concerned). I haven't yet quite worked out why it's not possible to detect the point at which the job is finished and examine the state at that point, so I can't comment further, but I might look again and ask stupid questions. pws