From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3528 invoked from network); 22 May 2007 01:46:47 -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:46:47 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 26360 invoked from network); 22 May 2007 01:46:41 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 22 May 2007 01:46:41 -0000 Received: (qmail 11835 invoked by alias); 22 May 2007 01:46:38 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 23450 Received: (qmail 11825 invoked from network); 22 May 2007 01:46:37 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 22 May 2007 01:46:37 -0000 Received: (qmail 26066 invoked from network); 22 May 2007 01:46:37 -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:46:33 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=first1; d=spodhuis.org; h=Received:Date:From:To:Cc:Subject:Message-ID:Mail-Followup-To:References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; b=Bg3drSzRzNqAHc/hOODu8ImADcCubzLxNfK56mx0AAcpJFcE/mck0h9IU8Ycn5e23PAgpc/IkPaK2RMyiI75xh5Vfx/6c3tVR/wYN0oqA/JT+pm59YnkEFJ2JCz1XmdHL6be8DX7zV0N6FLTkxmiMNFxd2fB0Lh59Yle3YQ8vi8=; Received: by smtp.spodhuis.org with local id 1HqJSK-0002ys-2h; Tue, 22 May 2007 01:46:32 +0000 Date: Mon, 21 May 2007 18:46:32 -0700 From: Phil Pennock To: Maddi Kopfermann Cc: Zsh-Workers Subject: Re: bindkey history-beginning-search-backwards; echo $widgts = crash Message-ID: <20070522014632.GA11326@redoubt.spodhuis.org> Mail-Followup-To: Maddi Kopfermann , Zsh-Workers References: <20070521202131.GA14758@finlandia.home.infodrom.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nFreZHaLTZJo0R7j" Content-Disposition: inline In-Reply-To: <20070521202131.GA14758@finlandia.home.infodrom.org> --nFreZHaLTZJo0R7j Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On 2007-05-21 at 22:21 +0200, Maddi Kopfermann wrote: > Hi Zsh Comrades, > > Yesterday i found what it seems to be a very old bug. > > bindkey history-beginning-search-backwards && history-beginning-search-backwards is not a standard widget; aside from this bug, you need to find which widget you really want. > echo $widgets crashes zsh, it does with zsh -f. > On #zsh Frank Terbeck had it crash even with 3.1.7. All > versions that have history-beginning-search-backwards did > crash, it seems. 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. % bindkey '^Z' fred % ^Z No such widget `fred' % print ${(v)widgets} [segfault] The attached patch ensures that there's an appropriate value for the key; it'll do as a work-around for now. #0 0x0000000801918291 in widgetstr (w=0x0) at zleparameter.c:78 78 if (w->flags & WIDGET_INT) (gdb) bt #0 0x0000000801918291 in widgetstr (w=0x0) at zleparameter.c:78 #1 0x00000008019184f8 in scanpmwidgets (ht=0x55cd40, func=0x80069a6d0 , flags=1) at zleparameter.c:134 #2 0x000000080067229f in scanmatchtable (ht=0x55cd40, pprog=0x0, sorted=0, flags1=0, flags2=33554432, scanfunc=0x80069a6d0 , scanflags=1) at hashtable.c:381 #3 0x000000080067258b in scanhashtable (ht=0x55cd40, sorted=0, flags1=0, flags2=33554432, scanfunc=0x80069a6d0 , scanflags=1) at hashtable.c:444 #4 0x000000080069a959 in paramvalarr (ht=0x55cd40, flags=1) at params.c:547 #5 0x000000080069aa25 in getvaluearr (v=0x7fffffffdf40) at params.c:565 #6 0x000000080069e409 in getarrvalue (v=0x7fffffffdf40) at params.c:1862 #7 0x00000008006bda52 in paramsubst (l=0x545068, n=0x545098, str=0x7fffffffe088, qt=0, ssub=0) at subst.c:2034 #8 0x00000008006b9afa in stringsubst (list=0x545068, node=0x545098, ssub=0, asssub=0) at subst.c:193 #9 0x00000008006b9400 in prefork (list=0x545068, flags=0) at subst.c:91 #10 0x0000000800664304 in execcmd (state=0x7fffffffe650, input=0, output=0, how=18, last1=2) at exec.c:2039 #11 0x000000080066253e in execpline2 (state=0x7fffffffe650, pcode=387, how=18, input=0, output=0, last1=0) at exec.c:1343 #12 0x000000080066199c in execpline (state=0x7fffffffe650, slcode=4098, how=18, last1=0) at exec.c:1129 #13 0x0000000800661261 in execlist (state=0x7fffffffe650, dont_change_job=0, exiting=0) at exec.c:935 #14 0x0000000800660dda in execode (p=0x544f68, dont_change_job=0, exiting=0) at exec.c:793 #15 0x000000080067bd5c in loop (toplevel=1, justonce=0) at init.c:180 #16 0x000000080067ede0 in zsh_main (argc=1, argv=0x7fffffffe780) at init.c:1347 #17 0x00000000004006cb in main (argc=1, argv=0x7fffffffe780) at ./main.c:93 -Phil --nFreZHaLTZJo0R7j Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="widget-crash.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:37:22 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) { --nFreZHaLTZJo0R7j--