Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: bindkey <whatever> history-beginning-search-backwards; echo $widgts = crash
- X-seq: zsh-workers 23451
- From: Phil Pennock <zsh-workers+phil.pennock@xxxxxxxxxxxx>
- To: Zsh-Workers <zsh-workers@xxxxxxxxxx>
- Subject: Re: bindkey <whatever> history-beginning-search-backwards; echo $widgts = crash
- Date: Mon, 21 May 2007 18:59:23 -0700
- 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=;
- In-reply-to: <20070522014632.GA11326@xxxxxxxxxxxxxxxxxxxx>
- Mail-followup-to: Zsh-Workers <zsh-workers@xxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <20070521202131.GA14758@xxxxxxxxxxxxxxxxxxxxxxxxxxx> <20070522014632.GA11326@xxxxxxxxxxxxxxxxxxxx>
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
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)) ||
Messages sorted by:
Reverse Date,
Date,
Thread,
Author