From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18289 invoked from network); 4 Aug 2008 17:26:10 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 4 Aug 2008 17:26:10 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 55309 invoked from network); 4 Aug 2008 17:26:00 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 4 Aug 2008 17:26:00 -0000 Received: (qmail 28408 invoked by alias); 4 Aug 2008 17:25:33 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 25384 Received: (qmail 28381 invoked from network); 4 Aug 2008 17:25:29 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 4 Aug 2008 17:25:29 -0000 Received: from cluster-d.mailcontrol.com (cluster-d.mailcontrol.com [217.69.20.190]) by bifrost.dotsrc.org (Postfix) with ESMTPS id 65FEF805A431 for ; Mon, 4 Aug 2008 19:25:24 +0200 (CEST) Received: from cameurexb01.EUROPE.ROOT.PRI ([193.128.72.68]) by rly10d.srv.mailcontrol.com (MailControl) with ESMTP id m74HPLE9025328 for ; Mon, 4 Aug 2008 18:25:22 +0100 Received: from news01.csr.com ([10.103.143.38]) by cameurexb01.EUROPE.ROOT.PRI with Microsoft SMTPSVC(6.0.3790.3959); Mon, 4 Aug 2008 18:25:12 +0100 Received: from news01.csr.com (localhost.localdomain [127.0.0.1]) by news01.csr.com (8.14.2/8.13.4) with ESMTP id m74HPCLs025750 for ; Mon, 4 Aug 2008 18:25:12 +0100 Received: from csr.com (pws@localhost) by news01.csr.com (8.14.2/8.14.2/Submit) with ESMTP id m74HPCOB025747 for ; Mon, 4 Aug 2008 18:25:12 +0100 X-Authentication-Warning: news01.csr.com: pws owned process doing -bs To: zsh-workers@sunsite.dk (Zsh hackers list) Subject: PATCH: crash with error on initialisation X-Mailer: MH-E 8.0.3; nmh 1.3; GNU Emacs 22.1.1 Date: Mon, 04 Aug 2008 18:25:12 +0100 Message-ID: <25746.1217870712@csr.com> From: Peter Stephenson X-OriginalArrivalTime: 04 Aug 2008 17:25:12.0948 (UTC) FILETIME=[0D853340:01C8F657] X-Scanned-By: MailControl A-08-50-03 (www.mailcontrol.com) on 10.68.0.120 X-Virus-Scanned: ClamAV 0.92.1/7935/Mon Aug 4 14:58:49 2008 on bifrost X-Virus-Status: Clean zsh crashes if there's an error on initialisation, for example if you try to run a non-existent file. This is because it can't load zsh/zle because it hasn't set up the type table yet. This causes a warning which tries to load zshzle... However, it doesn't need zsh/zle since it's only trying to trash the command line which doesn't exist. The fix is not to autoload for such things, which would cause zle to be loaded in many cases when not needed. This changed because I made all functions load zsh/zle; this is obviously wrong. Index: Src/init.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/init.c,v retrieving revision 1.88 diff -u -r1.88 init.c --- Src/init.c 1 Aug 2008 13:53:45 -0000 1.88 +++ Src/init.c 4 Aug 2008 17:24:19 -0000 @@ -1206,14 +1206,22 @@ /* autoload */ switch (zle_load_state) { case 0: - if (load_module("zsh/zle", NULL, 0) != 1) { - (void)load_module("zsh/compctl", NULL, 0); - ret = zle_entry_ptr(cmd, ap); - /* Don't execute fallback code */ - cmd = -1; - } else { - zle_load_state = 2; - /* Execute fallback code below */ + /* + * Some commands don't require us to load ZLE. + * These also have no fallback. + */ + if (cmd != ZLE_CMD_TRASH && cmd != ZLE_CMD_RESET_PROMPT && + cmd != ZLE_CMD_REFRESH) + { + if (load_module("zsh/zle", NULL, 0) != 1) { + (void)load_module("zsh/compctl", NULL, 0); + ret = zle_entry_ptr(cmd, ap); + /* Don't execute fallback code */ + cmd = -1; + } else { + zle_load_state = 2; + /* Execute fallback code below */ + } } break; -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070