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

Re: zsh malloc bug



Dave Yost wrote:
> zsh 4.2.0 hangs on my cygwin system when I try some of these scenarios.

I couldn't get this to happen on Solaris 8 or Fedora Core 1.  I would be
a bit suspicious about Cygwin, since they had to jump through lots of
hoops to make it look like a UNIX environment.

> BTW, the TRAPxxx documentation should be more explicit about whether trapping
>  the event prevents exit

Yes, it should say how the return status is handled and apparently it
doesn't.  That's a big omission.

> and what happens if you exit explicitly from within the trap.

I'm not quite sure what this means, since if you exit explicitly with
the trap it exits, but the recent behaviour is not to run exit traps at
that point.

Index: Doc/Zsh/func.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/func.yo,v
retrieving revision 1.7
diff -u -r1.7 func.yo
--- Doc/Zsh/func.yo	10 Jul 2001 08:59:18 -0000	1.7
+++ Doc/Zsh/func.yo	8 Jun 2004 13:17:22 -0000
@@ -193,6 +193,24 @@
 
 If a function of this form is defined and null,
 the shell and processes spawned by it will ignore tt(SIG)var(NAL).
+
+The return value from the function is handled specially.  If it is
+zero, the signal is assumed to have been handled, and execution continues
+normally.  Otherwise, the normal effect of the signal is produced;
+if this causes execution to terminate, the status returned to the shell is
+the status returned from the function.
+
+Programs terminated by uncaught signals typically return the status 128
+plus the signal number.  Hence the following causes the handler for
+tt(SIGINT) to print a message, then mimic the usual effect of the signal.
+
+example(TRAPINT() {
+  print "Caught SIGINT, aborting."
+  return $(( 128 + $1 ))
+})
+
+The functions tt(TRAPZERR), tt(TRAPDEBUG) and tt(TRAPEXIT) are never
+executed inside other traps.
 )
 findex(TRAPDEBUG)
 item(tt(TRAPDEBUG))(

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************



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