* Re: PATCH: partial word completion
@ 2000-04-18 1:20 Felix Rosencrantz
0 siblings, 0 replies; 4+ messages in thread
From: Felix Rosencrantz @ 2000-04-18 1:20 UTC (permalink / raw)
To: zsh-workers
Zsh seems to crash now with this patch. The third parameter to sub_join()
is NULL, which causes the crash. Here's the stack trace:
#0 0xed1ac in sub_join (a=0x16e948, b=0x16de38, e=0x0, anew=1)
at compmatch.c:1683
#1 0xededc in join_clines (o=0x16de38, n=0x16e948) at compmatch.c:1900
#2 0xe5240 in add_match_data (alt=0, str=0x170058 "zsh3.1.5", line=0x16e948,
ipre=0x16f278 "", ripre=0x0, isuf=0x16f280 "", pre=0x0, prpre=0x16f340 "",
ppre=0x16f298 "", pline=0x0, psuf=0x0, sline=0x0, suf=0x0, flags=1,
exact=0) at compcore.c:2205
#3 0xe3ba0 in addmatches (dat=0xefff7a10, argv=0xefff7b70) at compcore.c:1871
#4 0xd9f70 in bin_compadd (name=0x1c42c0 "compadd", argv=0xefff7b08,
ops=0xefff7c80 "", func=0) at complete.c:562
#5 0x24a44 in execbuiltin (args=0x1c4228, bn=0x15a70c) at builtin.c:368
Sorry not to provide a simple test case. If you need that I can investigate
a little more. The error happened in a directory with many files, and
some simple pruning didn't uncover the error.
-FR.
__________________________________________________
Do You Yahoo!?
Send online invitations with Yahoo! Invites.
http://invites.yahoo.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: PATCH: partial word completion
@ 2000-04-18 7:06 Sven Wischnowsky
0 siblings, 0 replies; 4+ messages in thread
From: Sven Wischnowsky @ 2000-04-18 7:06 UTC (permalink / raw)
To: zsh-workers
Felix Rosencrantz wrote:
> Zsh seems to crash now with this patch. The third parameter to sub_join()
> is NULL, which causes the crash. Here's the stack trace:
>
> ...
>
> Sorry not to provide a simple test case. If you need that I can investigate
> a little more. The error happened in a directory with many files, and
> some simple pruning didn't uncover the error.
Ouch. That was something between a typo and a thinko.
Better check the variable that will be used...
Bye
Sven
Index: Src/Zle/compmatch.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/compmatch.c,v
retrieving revision 1.5
diff -u -r1.5 compmatch.c
--- Src/Zle/compmatch.c 2000/04/17 07:56:25 1.5
+++ Src/Zle/compmatch.c 2000/04/18 07:04:09
@@ -1893,10 +1893,10 @@
for (tt = o;
(to = tt->next) &&
!cmp_anchors(tn, to, 1); tt = to);
- if (tt)
+ if (to)
break;
}
- if (tt) {
+ if (to) {
diff = sub_join(n, o, to, 1);
if (po)
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 4+ messages in thread
* PATCH: partial word completion
@ 2000-04-17 7:55 Sven Wischnowsky
0 siblings, 0 replies; 4+ messages in thread
From: Sven Wischnowsky @ 2000-04-17 7:55 UTC (permalink / raw)
To: zsh-workers
This could fail terribly with a common suffix and with empty parts.
Bye
Sven
Index: Src/Zle/compmatch.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/compmatch.c,v
retrieving revision 1.4
diff -u -r1.4 compmatch.c
--- Src/Zle/compmatch.c 2000/04/07 09:16:37 1.4
+++ Src/Zle/compmatch.c 2000/04/17 07:44:01
@@ -1767,7 +1767,7 @@
free_cline(o);
x = o;
o = tn;
- if (po && cmp_anchors(x, po, 0)) {
+ if (po && po->prefix && cmp_anchors(x, po, 0)) {
po->flags |= CLF_MISS;
po->max += diff;
} else {
@@ -1784,7 +1784,7 @@
if (tn && cmp_anchors(o, tn, 0)) {
diff = sub_join(o, n, tn, 0);
- if (po && cmp_anchors(n, pn, 0)) {
+ if (po && po->prefix && cmp_anchors(n, pn, 0)) {
po->flags |= CLF_MISS;
po->max += diff;
} else {
@@ -1850,7 +1850,7 @@
if (tn) {
diff = sub_join(o, n, tn, 0);
- if (po && cmp_anchors(n, pn, 0)) {
+ if (po && po->prefix && cmp_anchors(n, pn, 0)) {
po->flags |= CLF_MISS;
po->max += diff;
} else {
@@ -1864,19 +1864,21 @@
n = n->next;
continue;
} else {
- for (t = o; (tn = t->next) && !cmp_anchors(n, tn, 1);
- t = tn);
+ Cline to;
- if (tn) {
- diff = sub_join(n, o, tn, 1);
+ for (t = o; (to = t->next) && !cmp_anchors(n, to, 1);
+ t = to);
+ if (to) {
+ diff = sub_join(n, o, to, 1);
+
if (po)
- po->next = tn;
+ po->next = to;
else
- oo = tn;
+ oo = to;
x = o;
- o = tn;
- if (po && cmp_anchors(x, po, 0)) {
+ o = to;
+ if (po && po->prefix && cmp_anchors(x, po, 0)) {
po->flags |= CLF_MISS;
po->max += diff;
} else {
@@ -1885,14 +1887,42 @@
}
continue;
} else {
- if (o->flags & CLF_SUF)
- break;
+ Cline tt = NULL;
- o->word = o->line = o->orig = NULL;
- o->wlen = 0;
- free_cline(o->next);
- o->next = NULL;
- o->flags |= CLF_MISS;
+ for (t = n; (tn = t->next); t = tn) {
+ for (tt = o;
+ (to = tt->next) &&
+ !cmp_anchors(tn, to, 1); tt = to);
+ if (tt)
+ break;
+ }
+ if (tt) {
+ diff = sub_join(n, o, to, 1);
+
+ if (po)
+ po->next = to;
+ else
+ oo = to;
+ x = o;
+ o = to;
+ if (po && po->prefix && cmp_anchors(x, po, 0)) {
+ po->flags |= CLF_MISS;
+ po->max += diff;
+ } else {
+ o->flags |= CLF_MISS;
+ o->max += diff;
+ }
+ continue;
+ } else {
+ if (o->flags & CLF_SUF)
+ break;
+
+ o->word = o->line = o->orig = NULL;
+ o->wlen = 0;
+ free_cline(o->next);
+ o->next = NULL;
+ o->flags |= CLF_MISS;
+ }
}
}
}
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 4+ messages in thread
* PATCH: partial word completion
@ 2000-04-03 12:17 Sven Wischnowsky
0 siblings, 0 replies; 4+ messages in thread
From: Sven Wischnowsky @ 2000-04-03 12:17 UTC (permalink / raw)
To: zsh-workers
Some recent changes made a small bug show up, where, for example,
completion on an empty word in a directory with `foo.bar.baz' and
`boo.far.faz' inserted `.'.
The problem was that too many cline structs got the CLF_NEW flag
removed (CLF_NEW indicates newly build parts without anything
corresponding on the line).
Bye
Sven
P.S.: Are the log messages and the version numbers (_path_files went
from 1.2 to 1.4) ok, or am I doing something wrong?
P.P.S.: Yeah, right, I haven't tried to understand everything about
CVS' version numbering facilities yet.
P.P.P.S.: Have I just made a fool out of myself?
Index: Src/Zle/compmatch.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/compmatch.c,v
retrieving revision 1.2
diff -u -r1.2 compmatch.c
--- Src/Zle/compmatch.c 2000/04/01 20:49:48 1.2
+++ Src/Zle/compmatch.c 2000/04/03 11:58:52
@@ -351,7 +351,6 @@
p = bld_parts(s, sl, osl, &lp);
- p->flags &= ~CLF_NEW;
if (m && (m->flags & CMF_LEFT)) {
lp->flags |= CLF_SUF;
lp->suffix = lp->prefix;
@@ -384,7 +383,8 @@
lp->line = l; lp->llen = wl;
lp->word = w; lp->wlen = wl;
lp->orig = o; lp->olen = ol;
- lp->flags &= ~CLF_NEW;
+ if (o || ol)
+ lp->flags &= ~CLF_NEW;
/* Finally, put the new parts on the list. */
if (matchlastpart)
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2000-04-18 7:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-04-18 1:20 PATCH: partial word completion Felix Rosencrantz
-- strict thread matches above, loose matches on Subject: below --
2000-04-18 7:06 Sven Wischnowsky
2000-04-17 7:55 Sven Wischnowsky
2000-04-03 12:17 Sven Wischnowsky
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).