From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3613 invoked by alias); 25 Feb 2016 14:19:01 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 38025 Received: (qmail 26261 invoked from network); 25 Feb 2016 14:18:58 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 Message-ID: <56CF0718.8060708@inlv.org> Date: Thu, 25 Feb 2016 14:52:24 +0100 From: Martijn Dekker User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: zsh-workers@zsh.org CC: Peter Stephenson Subject: Re: [BUG] Sticky-sh POSIX_TRAPS are function-local References: <56C15DF1.8080405@inlv.org> <20160216095744.52cb8389@pwslap01u.europe.root.pri> <56C3B2E7.1090806@inlv.org> <20160225115339.7688264a@pwslap01u.europe.root.pri> In-Reply-To: <20160225115339.7688264a@pwslap01u.europe.root.pri> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit 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.