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

Re: jobs -Z will destory environ variables



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.



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