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

Re: zsh-3.0.3: another problem in Src/jobs.c



SUZUKI Hisao wrote:
> [snip]
> >!     if (shout && !ttyfrozen && !jn->stty_in_env && inforeground)
> >  	gettyinfo(&shttyinfo);
> [snip]
> 
> Aha!  A simple and elegant patch!  I am slightly worried since
> it does not check the process group, but actually it seems to be
> working very well.

It should not depend on process groups.  This should work if MONITOR is
unset and on systems without job control.

> However, I noticed a little bug (or, at least, a singular
> behavior) just now.  The variable "inforeground" referred in the
> patch will not be set true if the last command in a pipeline is
> in the current shell.  Hence, though it is artificial,
> 
> 	% stty erase ^H | :
> 
> has no effect since the last command is a shell builtin ":",

Yes.  And actually, the tty settings should also be saved when a
foreground process is suspended.

The patch below is for the original zsh-3.1.2 and zsh-3.0.3, without
Hisao's patch.  I do hope that this covers all cases now.

Zoltan


*** Src/jobs.c	1997/06/03 03:52:01	3.1.2.7
--- Src/jobs.c	1997/06/20 03:37:03
***************
*** 138,145 ****
      job = jn - jobtab;   /* compute job number */
  
      if (somestopped) {
! 	if (jn->stty_in_env && !jn->ty) {
! 	    jn->ty = (struct ttyinfo *) zalloc(sizeof(struct ttyinfo));
  	    gettyinfo(jn->ty);
  	}
  	if (jn->stat & STAT_STOPPED)
--- 138,146 ----
      job = jn - jobtab;   /* compute job number */
  
      if (somestopped) {
! 	if ((jn->stty_in_env || ttyfrozen) && shout && job == thisjob) {
! 	    if (!jn->ty)
! 		jn->ty = (struct ttyinfo *) zalloc(sizeof(struct ttyinfo));
  	    gettyinfo(jn->ty);
  	}
  	if (jn->stat & STAT_STOPPED)
***************
*** 155,161 ****
  	}
      }
  
!     if (shout && !ttyfrozen && !jn->stty_in_env)
  	gettyinfo(&shttyinfo);
  
      if (isset(MONITOR)) {
--- 156,162 ----
  	}
      }
  
!     if (shout && !ttyfrozen && !jn->stty_in_env && job == thisjob)
  	gettyinfo(&shttyinfo);
  
      if (isset(MONITOR)) {



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