From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13686 invoked by alias); 19 Sep 2013 14:42:25 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 31737 Received: (qmail 1114 invoked from network); 19 Sep 2013 14:42:09 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <130919074204.ZM16009@torch.brasslantern.com> Date: Thu, 19 Sep 2013 07:42:04 -0700 In-reply-to: <20130919094955.56c23268@pwslap01u.europe.root.pri> Comments: In reply to Peter Stephenson "Re: Segfault on "task " with zsh 5.0.2 [PATCH]" (Sep 19, 9:49am) References: <20130913122426.GA19439@sym.noone.org> <20130916171841.GG3544@sym.noone.org> <20130917095657.4cb4ccbf@pwslap01u.europe.root.pri> <20130917161058.GJ3544@sym.noone.org> <20130917163509.GK3544@sym.noone.org> <20130917200546.6094eb98@pws-pc.ntlworld.com> <130917200551.ZM14080@torch.brasslantern.com> <20130918215003.GU3544@sym.noone.org> <20130919094955.56c23268@pwslap01u.europe.root.pri> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: Segfault on "task " with zsh 5.0.2 [PATCH] MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Sep 19, 9:49am, Peter Stephenson wrote: } } The way i is decremented and p incremented at different points makes it } very difficult to see what's going on --- I suspect there's an argument } for moving the decrement just for clarity but this fix will do fine. I believe get_cadef is going to have the same bug, it uses the identical technique for managing its cache. diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c index 2c323ee..f8983c3 100644 --- a/Src/Zle/computil.c +++ b/Src/Zle/computil.c @@ -1608,7 +1608,7 @@ get_cadef(char *nam, char **args) return *p; } else if (!min || !*p || (*p)->lastt < (*min)->lastt) min = p; - if (i) + if (i > 0) min = p; if ((new = parse_cadef(nam, args))) { freecadef(*min); -- Barton E. Schaefer