From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2227 invoked from network); 22 May 2007 01:59:40 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00 autolearn=no version=3.2.0 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 22 May 2007 01:59:40 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 34194 invoked from network); 22 May 2007 01:59:30 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 22 May 2007 01:59:30 -0000 Received: (qmail 13088 invoked by alias); 22 May 2007 01:59:28 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 23451 Received: (qmail 13078 invoked from network); 22 May 2007 01:59:27 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 22 May 2007 01:59:27 -0000 Received: (qmail 33887 invoked from network); 22 May 2007 01:59:27 -0000 Received: from redoubt.spodhuis.org (HELO mx.spodhuis.org) (193.202.115.177) by a.mx.sunsite.dk with SMTP; 22 May 2007 01:59:23 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=first1; d=spodhuis.org; h=Received:Date:From:To:Subject:Message-ID:Mail-Followup-To:References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; b=ErYqAYs0ZJmEFWjrrczhHTWMbOpkbjVbaFiN7k8XDaGD3KDo/738HrpY9YV85z9ru05cfSckBhe674qMZfNtQpmxMdC8JrIMYKiEquF45T7o5x1EyPIFnymidK4qv3tZjglWvC+6YybLJDOVVwYSzzxPS1Dtg3LsRxli+WKchbM=; Received: by smtp.spodhuis.org with local id 1HqJel-00039d-Lk; Tue, 22 May 2007 01:59:23 +0000 Date: Mon, 21 May 2007 18:59:23 -0700 From: Phil Pennock To: Zsh-Workers Subject: Re: bindkey history-beginning-search-backwards; echo $widgts = crash Message-ID: <20070522015923.GA12001@redoubt.spodhuis.org> Mail-Followup-To: Zsh-Workers References: <20070521202131.GA14758@finlandia.home.infodrom.org> <20070522014632.GA11326@redoubt.spodhuis.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="5vNYLRcllDrimb99" Content-Disposition: inline In-Reply-To: <20070522014632.GA11326@redoubt.spodhuis.org> --5vNYLRcllDrimb99 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On 2007-05-21 at 18:46 -0700, Phil Pennock wrote: > This is a bug when there is no widget with the supplied name; the value > for the type can't be calculated. The code which loops over the widgets > doesn't notice that the widget doesn't really exist and the code which > produces a stringification doesn't handle it. Is it better for the $widgets associative array to pretend that such a key doesn't exist, or to acknowledge that it does exist with undefined value? Previous patch implemented the latter. This patch implements the former, keeping the "undefined" fallback around just in case there's another bug. Intuitively, the $widgets array shouldn't pretend that nodes don't exist, but then there's conflicting behaviour with getpmwidgets() which returns an empty string. I leave the decision to those with more experience. -Phil --5vNYLRcllDrimb99 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="widget-crash2.patch" diff -urp zsh-head/Src/Zle/zleparameter.c zsh-bindkey-crash/Src/Zle/zleparameter.c --- zsh-head/Src/Zle/zleparameter.c Tue Mar 7 13:31:44 2006 +++ zsh-bindkey-crash/Src/Zle/zleparameter.c Mon May 21 18:52:20 2007 @@ -75,6 +75,8 @@ createspecialhash(char *name, GetNodeFun static char * widgetstr(Widget w) { + if (!w) + return dupstring("undefined"); if (w->flags & WIDGET_INT) return dupstring("builtin"); if (w->flags & WIDGET_NCOMP) { @@ -127,6 +129,8 @@ scanpmwidgets(UNUSED(HashTable ht), Scan for (i = 0; i < thingytab->hsize; i++) for (hn = thingytab->nodes[i]; hn; hn = hn->next) { + if (!((Thingy) hn)->widget) + continue; pm.node.nam = hn->nam; if (func != scancountparams && ((flags & (SCANPM_WANTVALS|SCANPM_MATCHVAL)) || --5vNYLRcllDrimb99--