zsh-workers
 help / color / mirror / code / Atom feed
From: Phil Pennock <zsh-workers+phil.pennock@spodhuis.org>
To: Zsh-Workers <zsh-workers@sunsite.dk>
Subject: Re: bindkey <whatever> history-beginning-search-backwards; echo $widgts = crash
Date: Mon, 21 May 2007 18:59:23 -0700	[thread overview]
Message-ID: <20070522015923.GA12001@redoubt.spodhuis.org> (raw)
In-Reply-To: <20070522014632.GA11326@redoubt.spodhuis.org>

[-- Attachment #1: Type: text/plain, Size: 843 bytes --]

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

[-- Attachment #2: widget-crash2.patch --]
[-- Type: text/x-diff, Size: 782 bytes --]

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)) ||

  reply	other threads:[~2007-05-22  1:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-21 20:21 Maddi Kopfermann
2007-05-22  1:46 ` Phil Pennock
2007-05-22  1:59   ` Phil Pennock [this message]
2007-05-22  9:29     ` Peter Stephenson
2007-05-22  3:32   ` Maddi Kopfermann
2007-05-22  5:37     ` Bart Schaefer
2007-05-22  9:27       ` Maddi Kopfermann
2007-05-22  5:55     ` Phil Pennock
2007-05-22 13:32       ` Maddi Kopfermann
  -- strict thread matches above, loose matches on Subject: below --
2007-05-15  9:59 PATCH: reverse matching (tentative) Peter Stephenson
2007-05-15 21:06 ` Matt Wozniski
2007-05-21  9:49   ` Peter Stephenson
2007-05-21 18:42     ` bindkey <whatever> history-beginning-search-backwards; echo $widgts = crash Maddi Kopfermann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070522015923.GA12001@redoubt.spodhuis.org \
    --to=zsh-workers+phil.pennock@spodhuis.org \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).