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

Re: coredump on ( command & )



On Fri, 31 Aug 2007 15:06:39 +1000
Geoff Wing <gcw@xxxxxxx> wrote:
> Heyla,
> the following command is checking something invalid:
> 
> % ( echo & )
>  jobs.c:1254: No valid job in waitjobs.
> 
> [1]    4693 segmentation fault (core dumped)  (; echo &; )

I'm glad someone noticed... this is the new code to fix up multios that
exist in a subshell.  When we put a command into the background inside the
subshell there's no job control.  Or something like that.  So we just need
an extra test round the special case, leaving the standard code untouched.

Index: Src/exec.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/exec.c,v
retrieving revision 1.122
diff -u -r1.122 exec.c
--- Src/exec.c	31 Jul 2007 14:24:26 -0000	1.122
+++ Src/exec.c	31 Aug 2007 08:56:42 -0000
@@ -2910,7 +2910,8 @@
 	    if (fdtable[i] != FDT_UNUSED)
 		close(i);
 	closem(FDT_UNUSED);
-	waitjobs();
+	if (thisjob != -1)
+	    waitjobs();
 	_exit(lastval);
     }
     fixfds(save);



.



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