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

Re: zsh eats 100% CPU with completion in /



2009/11/1 Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>:
> Mikael Magnusson wrote:
>> I did the break after typing ./ and before pressing tab.
>
> Nothing leapt out of that.  "tokstr" seems to be coming back as "." and
> then the "." gets removed, as far as I can see, but looking at it out of
> context I might be wrong.
>
> Might be worth checking zlemetacs as well as zlemetaline and zlemetall
> on entry to get_comp_string() in case they're already wrong, otherwise
> it's probably down in the bowels of gettok() where it puts together the
> string it's returning.  I suspect a counting error---one of the myriad
> substractions to correct for all the things that need fixing on the way
> through the position calculations is wrong.

Before I actually have to start thinking and looking at the code, does
this tell you anything? In the working trace, I didn't do the cd ..
(this is from break zshlex)
I tried breaking on gettok but it appears my modules don't have debug
symbols, I might get back in a while if anything interesting shows up there.

--- /tmp/working	2009-11-02 01:43:42.060760548 +0100
+++ /tmp/broken	2009-11-02 01:46:26.331314015 +0100
@@ -357,14 +357,6 @@
 (gdb)
 1248			for (tt1 = tt; *tt1; tt1++) {
 (gdb)
-1249			    if (*tt1 == Snull) {
-(gdb)
-1248			for (tt1 = tt; *tt1; tt1++) {
-(gdb)
-1249			    if (*tt1 == Snull) {
-(gdb)
-1248			for (tt1 = tt; *tt1; tt1++) {
-(gdb)
 1258		    if (addedx && tt)
 (gdb)
 1259			chuck(tt + zlemetacs - wb - qsub);
@@ -496,7 +488,7 @@
 get_comp_string () at zle_tricky.c:1435
 1435		if (itype_end(s, IIDENT, 1) == s)
 (gdb)
-itype_end (ptr=0x8192ca8 "./", itype=128, once=1) at utils.c:3308
+itype_end (ptr=0x82fb8c0 "", itype=128, once=1) at utils.c:3308
 3308	    if (isset(MULTIBYTE) &&
 (gdb)
 3310		mb_metacharinit();
@@ -506,55 +498,9 @@
 (gdb)
 449	}
 (gdb)
-itype_end (ptr=0x8192ca8 "./", itype=128, once=1) at utils.c:3311
+itype_end (ptr=0x82fb8c0 "", itype=128, once=1) at utils.c:3311
 3311		while (*ptr) {
 (gdb)
-3313		    int len = mb_metacharlenconv(ptr, &wc);
-(gdb)
-mb_metacharlenconv (s=0x8192ca8 "./", wcp=0x77991ac8) at utils.c:4254
-4254	    if (!isset(MULTIBYTE)) {
-(gdb)
-4270	    if (itok(*s)) {
-(gdb)
-4276	    return mb_metacharlenconv_r(s, wcp, &mb_shiftstate);
-(gdb)
-mb_metacharlenconv_r (s=0x8192ca8 "./", wcp=0x77991ac8,
mbsp=0x80f0ccc) at utils.c:4205
-4205	    size_t ret = MB_INVALID;
-(gdb)
-4210	    for (ptr = s; *ptr; ) {
-(gdb)
-4211		if (*ptr == Meta) {
-(gdb)
-4216		    inchar = *ptr;
-(gdb)
-4217		ptr++;
-(gdb)
-4218		ret = mbrtowc(&wc, &inchar, 1, mbsp);
-(gdb)
-4220		if (ret == MB_INVALID)
-(gdb)
-4222		if (ret == MB_INCOMPLETE)
-(gdb)
-4224		if (wcp)
-(gdb)
-4225		    *wcp = wc;
-(gdb)
-4226		return ptr - s;
-(gdb)
-4237	}
-(gdb)
-mb_metacharlenconv (s=0x8192ca8 "./", wcp=0x77991ac8) at utils.c:4277
-4277	}
-(gdb)
-itype_end (ptr=0x8192ca8 "./", itype=128, once=1) at utils.c:3315
-3315		    if (!len)
-(gdb)
-3318		    if (wc == WEOF) {
-(gdb)
-3324		    } else if (len == 1 && isascii(*ptr)) {
-(gdb)
-3326			if (!zistype(*ptr,itype))
-(gdb)
 3376	    return (char *)ptr;
 (gdb)
 3377	}
@@ -562,150 +508,30 @@
 get_comp_string () at zle_tricky.c:1436
 1436		    nnb = s + MB_METACHARLEN(s);
 (gdb)
-mb_metacharlenconv (s=0x8192ca8 "./", wcp=0x0) at utils.c:4254
+mb_metacharlenconv (s=0x82fb8c0 "", wcp=0x0) at utils.c:4254
 4254	    if (!isset(MULTIBYTE)) {
 (gdb)
 4270	    if (itok(*s)) {
 (gdb)
 4276	    return mb_metacharlenconv_r(s, wcp, &mb_shiftstate);
 (gdb)
-mb_metacharlenconv_r (s=0x8192ca8 "./", wcp=0x0, mbsp=0x80f0ccc) at
utils.c:4205
+mb_metacharlenconv_r (s=0x82fb8c0 "", wcp=0x0, mbsp=0x80f0ccc) at utils.c:4205
 4205	    size_t ret = MB_INVALID;
 (gdb)
 4210	    for (ptr = s; *ptr; ) {
 (gdb)
-4211		if (*ptr == Meta) {
-(gdb)
-4216		    inchar = *ptr;
+4229	    if (wcp)
 (gdb)
-4217		ptr++;
+4232	    memset(mbsp, 0, sizeof(*mbsp));
 (gdb)
-4218		ret = mbrtowc(&wc, &inchar, 1, mbsp);
+4233	    if (ptr > s) {
 (gdb)
-4220		if (ret == MB_INVALID)
-(gdb)
-4222		if (ret == MB_INCOMPLETE)
-(gdb)
-4224		if (wcp)
-(gdb)
-4226		return ptr - s;
+4236		return 0;		/* Probably shouldn't happen */
 (gdb)
 4237	}
 (gdb)
-mb_metacharlenconv (s=0x8192ca8 "./", wcp=0x0) at utils.c:4277
+mb_metacharlenconv (s=0x82fb8c0 "", wcp=0x0) at utils.c:4277
 4277	}
 (gdb)
 get_comp_string () at zle_tricky.c:1439
 1439		for (tt = s; tt < s + zlemetacs_qsub - wb;) {

-- 
Mikael Magnusson



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