zsh-workers
 help / color / mirror / code / Atom feed
* bug: ZERR traps and functions.
@ 2007-01-10 22:41 Gene Carter
  2007-01-12 23:05 ` Peter Stephenson
  0 siblings, 1 reply; 2+ messages in thread
From: Gene Carter @ 2007-01-10 22:41 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 816 bytes --]

Greetings,

I believe I've found a bug in how ZSH handles functions and error trapping.

with zsh 4.3.2 on AIX 4.3.3...

If you set error trapping and a function returns non-zero, the shell exits,
but the code specified in the trap doesn't get executed.

This appears to be because of line 866 in exec.c, where the execution of
code depends on retflag being zero. Going in and taking out that condition
allows the code to work, but I don't have a concept for how many other
things that breaks.

Example of the bug:

########################
function a
{
    return 1
}

trap "print err" ZERR
set -e

print "###############\npre a"
a
print "post a\n###############"
##########################

Output:
17:33: [rfgadm@isriscwc {8}] /rfgadm/zsh 2
###############
pre a
17:33: [rfgadm@isriscwc {9}]

Thanks,
Gene Carter

[-- Attachment #2: Type: text/html, Size: 984 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-01-12 23:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-10 22:41 bug: ZERR traps and functions Gene Carter
2007-01-12 23:05 ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).