From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 63 invoked by alias); 18 Nov 2012 02:31:54 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 17409 Received: (qmail 5470 invoked from network); 18 Nov 2012 02:31:42 -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=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at linux.vnet.ibm.com does not designate permitted sender hosts) Date: Sun, 18 Nov 2012 10:31:33 +0800 From: Han Pingtian To: zsh-users@zsh.org, schaefer@brasslantern.com Subject: Re: jobs -Z will destory environ variables Message-ID: <20121118023133.GC2500@localhost.localdomain> References: <20121117085620.GA2500@localhost.localdomain> <121117093646.ZM9645@torch.brasslantern.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <121117093646.ZM9645@torch.brasslantern.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12111802-2876-0000-0000-0000021FABBE On Sat, Nov 17, 2012 at 09:36:46AM -0800, Bart Schaefer wrote: > On Nov 17, 4:56pm, Han Pingtian wrote: > } > } Looks like "jobs -Z new_name" will destory the environ of current zsh. > > Hmm, this is a new bug. It works (or at least doesn't destroy the > environment) in 4.2.x even on hosts where it fails in 5.0. > > Which means it's not directly related to the hackzero code in bin_fg, > but must instead be related to changes in the handling of the environ > strings themselves -- probably the introduction of setenv / unsetenv > for environment management where previously it was always copied to > new memory space. > > So what we need is likely this: > > Index: Src/jobs.c > =================================================================== > RCS file: /cvsroot/zsh/zsh/Src/jobs.c,v > retrieving revision 1.92 > diff -u -r1.92 jobs.c > --- Src/jobs.c 11 Oct 2012 16:36:14 -0000 1.92 > +++ Src/jobs.c 17 Nov 2012 17:35:45 -0000 > @@ -1743,12 +1743,14 @@ > goto done; > p = strchr(q, 0); > } > +#if !defined(HAVE_PUTENV) && !defined(USE_SET_UNSET_ENV) > for(; *envp; envp++) { > q = *envp; > if(q != p+1) > goto done; > p = strchr(q, 0); > } > +#endif > done: > hackspace = p - hackzero; > #endif This patch works just fine. Thanks a lot.