Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Id: Zsh Workers List <zsh-workers.zsh.org>
List-Post: <mailto:zsh-workers@zsh.org>
List-Help: <mailto:zsh-workers-help@zsh.org>
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: <56C4041F.5060602@inlv.org>
Date: Wed, 17 Feb 2016 06:24:47 +0100
From: Martijn Dekker <martijn@inlv.org>
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: Bart Schaefer <schaefer@brasslantern.com>
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> <160216202547.ZM3900@torch.brasslantern.com>
In-Reply-To: <160216202547.ZM3900@torch.brasslantern.com>
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
X-Seq: zsh-workers 38006

Bart Schaefer schreef op 17-02-16 om 05:25:
> On Feb 17, 12:38am, Martijn Dekker wrote:
> } 
> } With your current patch, the function-local trap wipes out the global
> } POSIX exit trap, so the last line of expected output doesn't appear.
> 
> Hrm.  I think the point is that there are no function-local traps in
> POSIX, so the POSIX trap obeys the POSIX rules even when another trap
> is set in non-POSIX scope.

But POSIX is irrelevant to function-local traps because they are not
defined in POSIX, so, once emulation mode is exited, there is nothing
that compels you to make them wipe out a global POSIX trap.

I think it would actually be more consistent with the intention of the
POSIX trap if it survived a function-local native zsh trap; the
intention of the POSIX trap was for it to be executed on program exit,
so having it wiped out by a temporary function-local trap doesn't seem
helpful.

> I could see an argument either way, though.  I could also see an argument
> that the localtraps option should affect this (even though it's not usually
> needed for global traps).

How do you think that option should affect this?

Thanks,

- M.

