From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21796 invoked by alias); 26 May 2011 09:15: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: 29374 Received: (qmail 14024 invoked from network); 26 May 2011 09:14:47 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at csr.com does not designate permitted sender hosts) Date: Thu, 26 May 2011 10:14:28 +0100 From: Peter Stephenson To: Subject: Re: TRAPALRM / TMOUT oddity Message-ID: <20110526101428.71e440e9@pwslap01u.europe.root.pri> In-Reply-To: <110525204737.ZM24434@torch.brasslantern.com> References: <110525204737.ZM24434@torch.brasslantern.com> Organization: Cambridge Silicon Radio X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.103.11.49] X-Scanned-By: MailControl A-10-80-00 (www.mailcontrol.com) on 10.68.0.135 On Wed, 25 May 2011 20:47:37 -0700 Bart Schaefer wrote: > Consider: > > % TRAPALRM() { print TIME IS UP; exit 1 } > % TMOUT=5 > > You'd expect the shell to exit in 5 seconds, but instead what happens > is that TIME IS UP is printed every 5 seconds until any key is > pressed, at which point the shell exits. > > The same behavior occurs when using "trap". Index: Src/Zle/zle_main.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_main.c,v retrieving revision 1.127 diff -p -u -r1.127 zle_main.c --- Src/Zle/zle_main.c 20 Dec 2010 10:28:43 -0000 1.127 +++ Src/Zle/zle_main.c 26 May 2011 09:12:43 -0000 @@ -633,7 +633,7 @@ raw_getbyte(long do_keytmout, char *cptr /* * Make sure a user interrupt gets passed on straight away. */ - if (selret < 0 && errflag) + if (selret < 0 && (errflag || retflag || breaks || exit_pending)) break; /* * Try to avoid errors on our special fd's from @@ -875,7 +875,7 @@ getbyte(long do_keytmout, int *timeout) icnt = 0; if (errno == EINTR) { die = 0; - if (!errflag && !retflag && !breaks) + if (!errflag && !retflag && !breaks && !exit_pending) continue; errflag = 0; breaks = obreaks; -- Peter Stephenson Software Engineer Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom