From: Peter Stephenson <pws@csr.com>
To: zsh-workers@sunsite.dk (Zsh hackers list)
Subject: Re: EXIT trap and the return status
Date: Mon, 28 Oct 2002 14:50:40 +0000 [thread overview]
Message-ID: <2076.1035816640@csr.com> (raw)
In-Reply-To: "Oliver Kiddle"'s message of "Thu, 24 Oct 2002 10:00:14 BST." <E184dqg-000286-00@bimbo.logica.co.uk>
Oliver Kiddle wrote:
> I was trying to work out why the _prefix completer that follows
> _approximate at the end of my completers is never being run in zsh 4.1.
> The trace looks like this:
>
> +_approximate:113> return 1
> +_main_complete:1> unfunction compadd
> +_main_complete:156> ret=0
> +_main_complete:157> break 2
>
> The `unfunction compadd' comes from _approximate doing
> trap 'unfunction compadd' EXIT INT
> The problem is that because that trap is successful, _approximate is
> returning 0 instead of 1. This possibly has something to do with the
> change in 17250. It doesn't seem right to me (and is inconsistent with
> ksh93). So is this a bug? If not, I'll adjust _approximate.
No, executing a trap shouldn't change the return from the function ---
except in the case (not applicable here) of a TRAPNAL function, where
the return value of that function is used to decide whether the shell
should consider the signal has been handled or should return from the
function where the signal occurred as if the signal had been received
without a trap. Probably that shouldn't apply to TRAPEXIT anyway.
It looks like it probably is an effect of 17250: I think the problem is
that the status value (lastval) at this point is expected to store the return
value from the function we are exiting from (which we want the trap to
leave alone), but if we do something clever like provoke the enclosing
function to exit, it can store the return value for that (which we want
to propagate). Perhaps there's an obvious answer but I can't see it at
the moment.
--
Peter Stephenson <pws@csr.com> Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK Tel: +44 (0)1223 692070
**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential
and/or privileged material.
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by
persons or entities other than the intended recipient is
prohibited.
If you received this in error, please contact the sender and
delete the material from any computer.
**********************************************************************
prev parent reply other threads:[~2002-10-28 15:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-10-24 9:00 Oliver Kiddle
2002-10-28 14:50 ` Peter Stephenson [this message]
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=2076.1035816640@csr.com \
--to=pws@csr.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).