zsh-workers
 help / color / mirror / code / Atom feed
From: "Sebastian Reuße" <seb@wirrsal.net>
To: zsh-workers@zsh.org
Subject: Call stack issues when running trap handler
Date: Fri, 21 Apr 2017 22:32:46 +0200	[thread overview]
Message-ID: <87efwlijrl.fsf@wirrsal.net> (raw)

I’ve noticed that under certain conditions, shell functions called from
inside an exit trap handler appear to never return. E.g., running the
following code will only yield «a» as output, indicating that callee
«echoa» never returns control to the caller «handler».

#+begin_src shell
trap handler EXIT

handler() {
    echoa
    echo b
}

echoa() {
    echo a
}

exit0() {
    exit
}

main() {
    exit0
}

main

#+end_src

When directly calling «exit0» or «exit» instead of «main», this issue
does not arise.

I was able to reproduce this both in Zsh 5.3.1 as well as today’s HEAD.

Kind regards,
SR


             reply	other threads:[~2017-04-21 20:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20170421203315epcas2p2bcf3453e9998002d444d4fa02a87b58e@epcas2p2.samsung.com>
2017-04-21 20:32 ` Sebastian Reuße [this message]
2017-04-21 22:19   ` Bart Schaefer
2017-04-24  9:00   ` Peter Stephenson
2017-04-24 16:16     ` Bart Schaefer
2017-04-24 17:17       ` Peter Stephenson
2017-04-24 17:39         ` Bart Schaefer
2017-04-26 19:27   ` Peter Stephenson
2017-04-26 19:52     ` Peter Stephenson
2017-04-26 21:15       ` Bart Schaefer
2017-05-11  7:58       ` Sebastian Reuße

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=87efwlijrl.fsf@wirrsal.net \
    --to=seb@wirrsal.net \
    --cc=zsh-workers@zsh.org \
    /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).