Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Segfault while testing __git_files functions

On Wed, 27 Apr 2011 02:16:04 -0400 (EDT)
"Benjamin R. Haskell" <zsh@xxxxxxxxxx> wrote:
> While trying to come up with a minimal "do __git_tree_files when I say 
> __git_files" example, I came upon an error that gives me a reproducible 
> segfault.
> Attached test script can be run from `zsh -ldf`:
> host% . ./git-break.zsh
> It'll create a git repo, and prep it for the point where it'll break if 
> you hit Tab.

... thanks to this I was able to try the heap debugging and look at the
result.  However, it's nothing to do with using invalid heaps for the
matcher group itself, it's simply that one particular element of the
structure isn't being duplicated properly, so it didn't take much
tracking down.

I expect there are other problems, though.

Index: Src/Zle/compcore.c
RCS file: /cvsroot/zsh/zsh/Src/Zle/compcore.c,v
retrieving revision 1.105
diff -p -u -r1.105 compcore.c
--- Src/Zle/compcore.c	18 Feb 2011 22:08:46 -0000	1.105
+++ Src/Zle/compcore.c	13 May 2011 23:18:31 -0000
@@ -2329,7 +2344,7 @@ addmatches(Cadata dat, char **argv)
 		dat->pre = dupstring(dat->pre);
 	    if (dat->suf)
 		dat->suf = dupstring(dat->suf);
-	    if (!dat->prpre && (dat->prpre = oppre)) {
+	    if (!dat->prpre && (dat->prpre = dupstring(oppre))) {
 	    } else

Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/

Messages sorted by: Reverse Date, Date, Thread, Author