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

Re: zsh 4.3.4 crashes in prompt-related code under Mac OS X



On Thu, 30 Aug 2007 10:57:11 +0200
Vincent Lefevre <vincent@xxxxxxxxxx> wrote:
> zsh 4.3.4 sometimes crashes in prompt-related code under Mac OS X.

Is it possible to get this with debugging code with line numbers?
(Generally speaking, without some fairly detailed debugging information
"sometimes crashes" reports tend to do little other than spread
despondency, although, to be fair, it's possible the desponency doesn't
spread further than me.)  If the crash is where it appears to be, I think
I'm eventually going to want to see the values of the arguments to
wcs_nicechar(), and the static variables buf, bufalloc and newalloc and the
automatic variable "s" inside wcs_nicechar().  (Or, obviously, a reliable way
of reproducing it.)

It may simply be a miscalculation of NICECHAR_MAX, in which case I've added
an extra debugging test.

Thanks
pws

Index: Src/utils.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/utils.c,v
retrieving revision 1.165
diff -u -r1.165 utils.c
--- Src/utils.c	20 Aug 2007 21:22:19 -0000	1.165
+++ Src/utils.c	30 Aug 2007 14:42:52 -0000
@@ -552,8 +552,12 @@
     if (swidep)
 	*swidep = s;
     for (mbptr = mbstr; ret; s++, mbptr++, ret--) {
+	DPUTS(s >= buf + NICECHAR_MAX,
+	      "BUG: buffer too small in wcs_nicechar");
 	if (imeta(*mbptr)) {
 	    *s++ = Meta;
+	    DPUTS(s >= buf + NICECHAR_MAX,
+		  "BUG: buffer too small for metafied char in wcs_nicechar");
 	    *s = *mbptr ^ 32;
 	} else {
 	    *s = *mbptr;


.



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