From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20809 invoked from network); 1 Sep 2004 17:37:27 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 1 Sep 2004 17:37:27 -0000 Received: (qmail 75616 invoked from network); 1 Sep 2004 17:37:22 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 1 Sep 2004 17:37:22 -0000 Received: (qmail 18750 invoked by alias); 1 Sep 2004 17:37:20 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 20300 Received: (qmail 18735 invoked from network); 1 Sep 2004 17:37:19 -0000 Received: from unknown (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 1 Sep 2004 17:37:19 -0000 Received: (qmail 72430 invoked from network); 1 Sep 2004 17:36:20 -0000 Received: from lhuumrelay3.lnd.ops.eu.uu.net (62.189.58.19) by a.mx.sunsite.dk with SMTP; 1 Sep 2004 17:36:19 -0000 Received: from MAILSWEEPER01.csr.com (mailhost1.csr.com [62.189.183.235]) by lhuumrelay3.lnd.ops.eu.uu.net (8.11.0/8.11.0) with ESMTP id i81HaIv11257 for ; Wed, 1 Sep 2004 17:36:18 GMT Received: from EXCHANGE02.csr.com (unverified [192.168.137.45]) by MAILSWEEPER01.csr.com (Content Technologies SMTPRS 4.3.12) with ESMTP id for ; Wed, 1 Sep 2004 18:35:26 +0100 Received: from news01.csr.com ([192.168.143.38]) by EXCHANGE02.csr.com with Microsoft SMTPSVC(5.0.2195.6713); Wed, 1 Sep 2004 18:36:57 +0100 Received: from news01.csr.com (localhost.localdomain [127.0.0.1]) by news01.csr.com (8.12.11/8.12.11) with ESMTP id i81HaGPc011458 for ; Wed, 1 Sep 2004 18:36:16 +0100 Received: from csr.com (pws@localhost) by news01.csr.com (8.12.11/8.12.11/Submit) with ESMTP id i81HaFv1011455 for ; Wed, 1 Sep 2004 18:36:15 +0100 Message-Id: <200409011736.i81HaFv1011455@news01.csr.com> X-Authentication-Warning: news01.csr.com: pws owned process doing -bs To: zsh-workers@sunsite.dk Subject: Re: zsh exits after delete-char-or-list and two ^Cs In-reply-to: "Danek Duvall"'s message of "Wed, 25 Aug 2004 10:04:56 PDT." <20040825170456.GA7526@la-z-boy.comfychair.org> Date: Wed, 01 Sep 2004 18:36:15 +0100 From: Peter Stephenson X-OriginalArrivalTime: 01 Sep 2004 17:36:57.0519 (UTC) FILETIME=[478673F0:01C4904A] X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=0.0 required=6.0 tests=none autolearn=no version=2.63 X-Spam-Hits: 0.0 Danek Duvall wrote: > This happens with 4.0.6, 4.2.0 and 4.2.1, the first two on Linux, the > latter on Solaris. If I use delete-char-or-list, then hit control-C twice, > the first time cancels the command-line where I hit ^D, and the second one > exits the shell. Obviously if I tried to look at this today after my holiday it would just get me all frustrated. So that would be a bad idea. Here's a patch. The problem is that there's a special test to see if there was an EOF character (which must be ^D for the bug to turn up in this particular form) at the start of the line. This test was erroneously triggered on the second ^C as the input character hadn't changed from the ^D used to list completion. The first ^C didn't trigger it because the line hadn't yet been emptied. The functions don't pass back the state properly, so it's difficult to check what actually happened (i.e. EOF or interrupt); maybe it can be done better than this. Note that errflag isn't set at the point of the patch if there was a ^C. This seems to be deliberate; see the handling of EINTR in getkey(). I think it's also to do with the lack of distinction between an interruption and an EOF---in loop(), we exit the command loop, and hence the shell, if we get an end-of-input token and errflag is *not* set. I thought about resetting lastchar at the start of each line. However, I think there are cases where that doesn't work. Index: Src/Zle/zle_main.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_main.c,v retrieving revision 1.49 diff -u -r1.49 zle_main.c --- Src/Zle/zle_main.c 13 Jul 2004 09:41:37 -0000 1.49 +++ Src/Zle/zle_main.c 1 Sep 2004 17:15:15 -0000 @@ -687,12 +687,19 @@ reselectkeymap(); selectlocalmap(NULL); bindk = getkeycmd(); - if (!ll && isfirstln && !(zlereadflags & ZLRF_IGNOREEOF) && - lastchar == eofchar) { - eofsent = 1; - break; - } if (bindk) { + if (!ll && isfirstln && !(zlereadflags & ZLRF_IGNOREEOF) && + lastchar == eofchar) { + /* + * Slight hack: this relies on getkeycmd returning + * a value for the EOF character. However, + * undefined-key is fine. That's necessary because + * otherwise we can't distinguish this case from + * a ^C. + */ + eofsent = 1; + break; + } if (execzlefunc(bindk, zlenoargs)) handlefeep(zlenoargs); handleprefixes(); -- Peter Stephenson Software Engineer CSR Ltd., Science Park, Milton Road, Cambridge, CB4 0WH, UK Tel: +44 (0)1223 692070 ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com **********************************************************************