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

Re: zsh-3.0-pre2 cores on irix 5.3 (?)



> Turns out that "source" or "." inside any shell function will trigger
> that BUG warning, which isn't really a bug at all -- it's doshfunc()
> calling loop() recursively, so the allocation stack depth reflects the
> depth of recursion.

The allocation stack can be deeper than locallevel in loop() when source
is used inside a command substitution or when source is called from a
trap.  So the patch below is more correct that Bart's patch.  Note that
in the main top level loop alloc_stackp should always be zero.

Zoltan

rcsdiff -qc -kk -r2.23 -r2.24 Src/init.c
*** Src/init.c
--- Src/init.c	1996/07/07 16:03:48	2.24
***************
*** 101,106 ****
--- 101,109 ----
  loop(int toplevel)
  {
      List list;
+ #ifdef DEBUG
+     int oasp = toplevel ? 0 : alloc_stackp;
+ #endif
  
      pushheap();
      for (;;) {
***************
*** 128,134 ****
  	    if (toplevel)
  		noexitct = 0;
  	}
! 	DPUTS(alloc_stackp, "BUG: alloc_stackp != 0 in loop()");
  	if (ferror(stderr)) {
  	    zerr("write error", NULL, 0);
  	    clearerr(stderr);
--- 131,137 ----
  	    if (toplevel)
  		noexitct = 0;
  	}
! 	DPUTS(alloc_stackp != oasp, "BUG: alloc_stackp changed in loop()");
  	if (ferror(stderr)) {
  	    zerr("write error", NULL, 0);
  	    clearerr(stderr);




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