Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: exit status problem



On Sat, 04 Dec 2010 11:36:17 -0800
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> 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 <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



Messages sorted by: Reverse Date, Date, Thread, Author