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

Re: Job table full



On Wed, May 12, 2004 at 02:40:29PM +0100, Peter Stephenson wrote:
> A reliable way of reproducing it would help.

It's pretty easy:

    zsh -f
    preexec() { x=`echo hi` }
    sleep 1 &
    :              [execute any 20 commands]

The problem appears to be that, after the job-control run, the value of
"thisjob" in the preexec() function becomes -1.  This comparison then
fails due to a signed/unsigned mismatch:

    if (thisjob >= jobtabsize - 1 && !expandjobtab()) {

This -1 value for "thisjob" only seems to affect a fork in preexec()
(running normal commands doesn't call zfork() with thisjob set to -1).

I fixed the problem by simply adding an "(int)" cast in front of the
jobtabsize value, but perhaps the value of "thisjob" should really be
fixed so that it doesn't get left at -1?

..wayne..
--- Src/exec.c	21 May 2004 11:19:30 -0000	1.62
+++ Src/exec.c	25 May 2004 17:51:40 -0000
@@ -219,7 +219,7 @@ zfork(void)
     /*
      * Is anybody willing to explain this test?
      */
-    if (thisjob >= jobtabsize - 1 && !expandjobtab()) {
+    if (thisjob >= (int)jobtabsize - 1 && !expandjobtab()) {
 	zerr("job table full", NULL, 0);
 	return -1;
     }


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