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

bug: ZERR traps and functions.



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



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