From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19276 invoked from network); 25 Apr 2005 06:37:25 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 25 Apr 2005 06:37:25 -0000 Received: (qmail 48507 invoked from network); 25 Apr 2005 06:37:12 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 25 Apr 2005 06:37:12 -0000 Received: (qmail 7853 invoked by alias); 25 Apr 2005 06:37:05 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 8750 Received: (qmail 7843 invoked from network); 25 Apr 2005 06:37:04 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 25 Apr 2005 06:37:04 -0000 Received: (qmail 47477 invoked from network); 25 Apr 2005 06:37:04 -0000 Received: from lakermmtao10.cox.net (68.230.240.29) by a.mx.sunsite.dk with SMTP; 25 Apr 2005 06:36:58 -0000 Received: from quark.hightek.org ([68.12.75.33]) by lakermmtao10.cox.net (InterMail vM.6.01.04.00 201-2131-118-20041027) with ESMTP id <20050425063656.JIJF7787.lakermmtao10.cox.net@quark.hightek.org> for ; Mon, 25 Apr 2005 02:36:56 -0400 Received: by quark.hightek.org (Postfix, from userid 501) id A474C45589; Mon, 25 Apr 2005 01:35:21 -0500 (CDT) Date: Mon, 25 Apr 2005 01:35:21 -0500 From: Vincent Stemen To: zsh-users@sunsite.dk Subject: localtraps Message-ID: <20050425063521.GA17598@quark.hightek.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i X-Spam-Checker-Version: SpamAssassin 3.0.2 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, score=-2.6 required=6.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.2 X-Spam-Hits: -2.6 Hi. I don't seem to be able to get the localtraps option to work. Here is my test script #!/bin/zsh # sigtest signal() { setopt LOCAL_TRAPS trap "echo 'executing local signal() trap'" INT echo "--- got signal ---" sleep 2 } trap signal INT for n in 1 2 3 4 5 6 do echo -n "." sleep 1 done echo I expected to see "--- got signal ---" if I hit ^C, then, if I hit ^C again within 2 seconds, before it exits signal(), I expected to see "executing local signal() trap". If I wait at least 2 seconds until I see another '.' printed, then hit ^C again, I expected to see "--- got signal ---" again. On zsh 4.2.0 (i386-unknown-freebsd5.2.1) the trap inside signal() seems to have no effect. Here is what I got # ./sigtest .^C--- got signal --- ^C--- got signal --- ^C--- got signal --- ..^C--- got signal --- .. If I do not set localtraps, then the trap inside signal() works as expected. # ./sigtest ^C--- got signal --- ^Cexecuting local signal() trap .^Cexecuting local signal() trap .^Cexecuting local signal() trap ..^Cexecuting local signal() trap . On zsh 4.2.1 (i386--netbsdelf) I got a different result with localtraps set. # ./sigtest .^C--- got signal --- ^C^Cexecuting local signal() trap ..^Cexecuting local signal() trap ... As you can see, on 4.2.1 the trap inside signal() works, but the "setopt LOCAL_TRAPS" has no effect. It never resets the signal back when it exits the signal() function. If I was doing something wrong, I expected to get the same result on both systems. Am I overlooking something? Regards, Vincent -- Vincent Stemen Avoid the VeriSign/Network Solutions domain registration trap! Read how Network Solutions (NSI) was involved in stealing our domain name. http://www.InetAddresses.net