zsh-workers
 help / color / mirror / code / Atom feed
From: Martijn Dekker <martijn@inlv.org>
To: zsh-workers@zsh.org
Cc: Peter Stephenson <p.stephenson@samsung.com>
Subject: Re: [BUG] Sticky-sh POSIX_TRAPS are function-local
Date: Thu, 25 Feb 2016 14:52:24 +0100	[thread overview]
Message-ID: <56CF0718.8060708@inlv.org> (raw)
In-Reply-To: <20160225115339.7688264a@pwslap01u.europe.root.pri>

Peter Stephenson schreef op 25-02-16 om 12:53:
> I think this makes nested native mode EXIT traps work while preserving
> a global POSIX mode EXIT trap.

It's nearly there. The new test case in C03traps.ztst succeeds.

But if a function defined with sticky emulation sets a POSIX trap, and
that function is called from native zsh, then the old behaviour returns
and a subsequent function-local trap wipes out the global POSIX trap. So
this still kills my POSIX library functions that set a trap.

New test script that does not succeed yet:

#! Src/zsh -f
echo entering program
emulate sh -c 'spt() { trap "echo POSIX exit trap triggered" EXIT; }'
fn() {
   trap "echo native zsh function-local exit trap triggered" EXIT
   echo entering native zsh function
}
spt
fn
echo exiting program

Expected output is identical to that of the C03traps.ztst test case.

Many thanks,

- M.


  reply	other threads:[~2016-02-25 14:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-15  5:11 Martijn Dekker
2016-02-16  9:57 ` Peter Stephenson
2016-02-16 12:46   ` Peter Stephenson
2016-02-16 23:38   ` Martijn Dekker
2016-02-17  4:25     ` Bart Schaefer
2016-02-17  5:24       ` Martijn Dekker
2016-02-19 18:59         ` Bart Schaefer
2016-02-17 10:36     ` Peter Stephenson
2016-02-25 11:53     ` Peter Stephenson
2016-02-25 13:52       ` Martijn Dekker [this message]
2016-02-25 14:17         ` Peter Stephenson
2016-03-04 18:02         ` 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=56CF0718.8060708@inlv.org \
    --to=martijn@inlv.org \
    --cc=p.stephenson@samsung.com \
    --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).