zsh-workers
 help / color / mirror / code / Atom feed
From: "Gene Carter" <gananda@gmail.com>
To: zsh-workers@sunsite.dk
Subject: bug: ZERR traps and functions.
Date: Wed, 10 Jan 2007 17:41:13 -0500	[thread overview]
Message-ID: <bf7e3eaf0701101441o33b52166x2979e12287b6f605@mail.gmail.com> (raw)

[-- 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 --]

             reply	other threads:[~2007-01-10 22:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-10 22:41 Gene Carter [this message]
2007-01-12 23:05 ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bf7e3eaf0701101441o33b52166x2979e12287b6f605@mail.gmail.com \
    --to=gananda@gmail.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).