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

Re: zsh crashes with floating point exception



Andy Spiegl wrote:
> > At this point in debugging, could you run 
> 
> (gdb) p kringnum
> $1 = 0
> (gdb) p kringsize
> $2 = 0
> (gdb) p kring
> $3 = (struct cutbuffer *) 0x819cba0

Thanks.

I'm more convinced than ever you haven't got the default widget.  Could
you run "zle -lL | grep backward-kill-line", and if that shows something,
"which <function>" where <function> is the last word on the line?

If that doesn't show anything, I'm stumped, but I'll look again when I
have got more time.

Regardless of whether it does or not, I think I like the following
patch (applies to 4.3.4 and the state of the art)...

Index: Src/Zle/zle_params.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_params.c,v
retrieving revision 1.29
diff -u -r1.29 zle_params.c
--- Src/Zle/zle_params.c	19 May 2006 10:16:01 -0000	1.29
+++ Src/Zle/zle_params.c	19 Nov 2007 16:43:21 -0000
@@ -497,16 +497,18 @@
 	 */
 	int kpos = 0;
 	kringsize = arrlen(x);
-	kring = (Cutbuffer)zshcalloc(kringsize * sizeof(struct cutbuffer));
-	for (p = x; *p; p++) {
-	    int n, len = strlen(*p);
-	    kptr = kring + kpos;
-
-	    kptr->buf = stringaszleline(*p, 0, &n, NULL, NULL);
-	    kptr->len = n;
-
-	    zfree(*p, len+1);
-	    kpos = (kpos + kringsize -1 ) % kringsize;
+	if (kringsize != 0) {
+	    kring = (Cutbuffer)zshcalloc(kringsize * sizeof(struct cutbuffer));
+	    for (p = x; *p; p++) {
+		int n, len = strlen(*p);
+		kptr = kring + kpos;
+
+		kptr->buf = stringaszleline(*p, 0, &n, NULL, NULL);
+		kptr->len = n;
+
+		zfree(*p, len+1);
+		kpos = (kpos + kringsize -1 ) % kringsize;
+	    }
 	}
 	free(x);
     }

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070



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