From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15322 invoked by alias); 5 Dec 2010 17:43:48 -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: 28475 Received: (qmail 3567 invoked from network); 5 Dec 2010 17:43:35 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_00,RCVD_IN_PSBL autolearn=no version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at ntlworld.com designates 81.103.221.56 as permitted sender) Date: Sun, 5 Dec 2010 16:51:51 +0000 From: Peter Stephenson To: Zsh Hackers' List Subject: Re: exit status problem Message-ID: <20101205165151.643dd5a1@pws-pc.ntlworld.com> In-Reply-To: <101204113617.ZM6156@torch.brasslantern.com> References: <20101203152438.GL1727@prunille.vinc17.org> <20101203160916.42e78913@pwslap01u.europe.root.pri> <20101204010313.GM1727@prunille.vinc17.org> <101204113617.ZM6156@torch.brasslantern.com> X-Mailer: Claws Mail 3.7.6 (GTK+ 2.22.0; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Cloudmark-Analysis: v=1.1 cv=X0sWjjQ37bMP4yB/pNNinY3VxVB2n/hmdAjhihaCFGs= c=1 sm=0 a=kj9zAlcOel0A:10 a=q2GGsy2AAAAA:8 a=NLZqzBF-AAAA:8 a=USBHQoRh2KuyBaQ3IycA:9 a=dd1cLnN_aPG6qXGHIsJH8jVV76UA:4 a=CjuIK1q_8ugA:10 a=I6wTmPyJxzYA:10 a=_dQi-Dcv4p4A:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 On Sat, 04 Dec 2010 11:36:17 -0800 Bart Schaefer wrote: > On Dec 4, 2:03am, Vincent Lefevre wrote: > } > } A backgrounded pipeline returns a status of zero. > } > } It seems to be a bug in zsh 4.3.10 that has been fixed in the latest > } dev versions. Do you have more information? > > It was a bug at least as far back as 4.2.0. Backgrounded jobs appear > not to have changed the foreground status until sometime post-4.3.10, > but I'm not finding a likely-looking ChangeLog entry unless this fix > was a side-effect of adding POSIX_JOBS behavior. Or maybe it's this: > > * users/15217: Src/Zle/zle_main.c: use top-level status > when redrawing prompt. (Moved to zsh-workers.) I can't see it explicitly, either, but there were numerous changes that vaguely affect the area. The most likely looks to me like the change for resetting the status on a command that executes no code: see zsh-workers/27106 and some later related fixes. You don't usually get this at the command line --- you have to do the equivalent of eval'ing an empty sring --- but it's broadly what's going on here as far as the main shell is concerned, since all explicit code is executed in a subshell. This ensures it stays fixed, now we've noticed. Index: Test/A05execution.ztst =================================================================== RCS file: /cvsroot/zsh/zsh/Test/A05execution.ztst,v retrieving revision 1.6 diff -p -u -r1.6 A05execution.ztst --- Test/A05execution.ztst 7 Aug 2008 16:25:16 -0000 1.6 +++ Test/A05execution.ztst 5 Dec 2010 16:45:53 -0000 @@ -171,3 +171,10 @@ 0:trap ZERR >Command failed again. >Command failed again. + + false + sleep 1000 & + print $? + kill $! +0:Status reset by starting a backgrounded command +>0 -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/