From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3823 invoked by alias); 24 Apr 2015 06:52:34 -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: 34952 Received: (qmail 28114 invoked from network); 24 Apr 2015 06:52:19 -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=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=8kB+y/QFCvUsVLBZk0OX/P36RN+ivpQduOazdOx26Bc=; b=Gb9RsRrMxwft4ZU7eYit2b5C4VPblM3Rom4HgVdNo37JHgaHXFwr+OOpllWq0v9328 Sr5mv4fFKI6KmL4yJoYiLLSvG+Vq/Yzjrlvjwb4IeVRNVb0Jrfy5KA9DQ44WIhSvEpVM xw1RRd6rqa1Nnz9PjLIQVsNsXvfJR5Muu884AUuADQeZnWch3InK5ofSGMhUg9wLX+lN SdgVC0hxAARiHDXWXhOLMjPp59NZM5OitrD9EF8A0PG0gwe+zddpTQvLJm9lm9aJWQvB iD8836cYG/xFOVHDJpdMhazrCdEcvli5xFEiitFv9Os9QKL1gOd6OXDttN0NXB6fHz6u 1e8A== X-Gm-Message-State: ALoCoQk/j0W0TSzELiWXdv7UdP3wmw/VRDbwjleILGD6udkRc/BZulMfAOCj6nKfxFzUI+8295tB MIME-Version: 1.0 X-Received: by 10.194.61.208 with SMTP id s16mr12737600wjr.135.1429856575749; Thu, 23 Apr 2015 23:22:55 -0700 (PDT) In-Reply-To: <20150423211331.5ea4baf0@ntlworld.com> References: <5537E450.9060205@thequod.de> <20150422222627.1f6154e9@ntlworld.com> <150422215539.ZM14251@torch.brasslantern.com> <20150423211331.5ea4baf0@ntlworld.com> Date: Thu, 23 Apr 2015 23:22:55 -0700 Message-ID: Subject: Re: Using "source" in a function breaks job control From: Bart Schaefer To: "Zsh Hackers' List" Content-Type: text/plain; charset=UTF-8 On Thu, Apr 23, 2015 at 1:13 PM, Peter Stephenson wrote: > On Wed, 22 Apr 2015 21:55:39 -0700 > Bart Schaefer wrote: >> It has something to do with tracking the job table. > > Looks like we lost STAT_SUPERJOB in the flags of the job that got > created when we forked. That was the needed clue. The problem is that list_pipe_job is wrong following the return from source(). The complications are that (1) list_pipe_job is static to exec.c whereas source() is in init.c, and (2) when I tried exporting list_pipe_job so it could be saved/restored in source(), it fixed this issue but caused the test for "status of recently exited background jobs is recorded" to fail (which confuses me, because I can't see any reason source() would get involved in that test). Perhaps source() should be using execsave()/execrestore() instead of the stack of local copies of the job state globals that it maintains?