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

Re: setopt localfunctions, and two bugs with disable?



> zagzig[440] functions
> 	(... lots of output suppressed ...)
> undefined work () { }
> undefined xvi () { }
> undefined zed () { }
> undefined zfind () { }
> undefined zlook () { }
> undefined zm () { }
> 	(... more output suppressed ...)
> zagzig[441] disable -fm \*
> zagzig[442] functions
> undefined xvi () { }
> zagzig[443] enable -fm \*
> zagzig[444] functions
> 	(... same output as history 440 ...)
> zagzig[445]
> 
> How did `xvi' survive through the "disable" command?

Please try to investigate it further so that I could reproduce this bug.

> Also, the shell in which I performed the above actions appears to have
> silently exited (and without saving history) upon the next expiration of
> TMOUT.  I suspect that `disable -fm \*` did something bad with respect
> to my TRAPALRM() function and the associated signal handlers, or at least
> that `enable -fm \*` failed to restore something.

You are right, disabling a TRAP functions really removes the function.  The
patch below is a fix for that.  If a disable TRAPxxx function is enabled
the currently set trap with the trap builtin is replaced by the function.

The fix is not very elegant but it seems to work.

Zoltan

*** Src/hashtable.c	1996/11/02 22:47:53	3.1.0.2
--- Src/hashtable.c	1996/11/03 22:38:17
***************
*** 698,705 ****
  disableshfuncnode(HashNode hn, int flags)
  {
      hn->flags |= DISABLED;
!     if (!strncmp(hn->nam, "TRAP", 4))
! 	unsettrap(getsignum(hn->nam + 4));
  }
  
  /* Re-enable an entry in the shell function hash table.  *
--- 698,709 ----
  disableshfuncnode(HashNode hn, int flags)
  {
      hn->flags |= DISABLED;
!     if (!strncmp(hn->nam, "TRAP", 4)) {
! 	int signum = getsignum(hn->nam + 4);
! 	sigtrapped[signum] &= ~ZSIG_FUNC;
! 	sigfuncs[signum] = NULL;
! 	unsettrap(signum);
!     }
  }
  
  /* Re-enable an entry in the shell function hash table.  *



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