* Re: segfault in 3.1.6 in completion
@ 2000-02-24 9:36 Sven Wischnowsky
2000-02-24 16:37 ` Greg Klanderman
0 siblings, 1 reply; 3+ messages in thread
From: Sven Wischnowsky @ 2000-02-24 9:36 UTC (permalink / raw)
To: zsh-workers; +Cc: Greg Klanderman
Greg Klanderman wrote:
> Start 3.1.6 with no init files and load the below attached completion
> functions. Now if you go into a directory containing CVS controlled
> files and try
>
> % cvstest foobar/
>
> (where foobar is some directory) and hit TAB you get a crash
>
> Program received signal SIGSEGV, Segmentation fault.
Oops. compctl didn't stay up-to-date with respect to optimised
match-storing.
And then there was the problem that the display list wasn't stored.
Bye
Sven
diff -ru ../z.old/Src/Zle/compctl.c Src/Zle/compctl.c
--- ../z.old/Src/Zle/compctl.c Thu Feb 24 09:54:17 2000
+++ Src/Zle/compctl.c Thu Feb 24 10:32:41 2000
@@ -3763,10 +3763,11 @@
for (ln = firstnode(matches); ln; ln = nextnode(ln)) {
m = (Cmatch) getdata(ln);
if (m->ppre) {
+ char *s = (m->psuf ? m->psuf : "");
char *p = (char *) zhalloc(strlen(m->ppre) + strlen(m->str) +
- strlen(m->psuf) + 1);
+ strlen(s) + 1);
- sprintf(p, "%s%s%s", m->ppre, m->str, m->psuf);
+ sprintf(p, "%s%s%s", m->ppre, m->str, s);
addlinknode(args, dupstring(p));
} else
addlinknode(args, dupstring(m->str));
@@ -3799,6 +3800,9 @@
endcmgroup(yaptr);
begcmgroup("default", 0);
}
+ } else {
+ endcmgroup(yaptr);
+ begcmgroup("default", 0);
}
} else if ((tt = cc->explain)) {
tt = dupstring(tt);
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: segfault in 3.1.6 in completion
2000-02-24 9:36 segfault in 3.1.6 in completion Sven Wischnowsky
@ 2000-02-24 16:37 ` Greg Klanderman
0 siblings, 0 replies; 3+ messages in thread
From: Greg Klanderman @ 2000-02-24 16:37 UTC (permalink / raw)
To: Sven Wischnowsky; +Cc: zsh-workers, Greg Klanderman
Thanks Sven,
However I don't see code anything like that in 3.1.6 compctl.c ...
I'm assuming that patch is wrt current development code?
Greg
>>>>> "Sven" == Sven Wischnowsky <wischnow@informatik.hu-berlin.de> writes:
> Greg Klanderman wrote:
>> Start 3.1.6 with no init files and load the below attached completion
>> functions. Now if you go into a directory containing CVS controlled
>> files and try
>>
>> % cvstest foobar/
>>
>> (where foobar is some directory) and hit TAB you get a crash
>>
>> Program received signal SIGSEGV, Segmentation fault.
> Oops. compctl didn't stay up-to-date with respect to optimised
> match-storing.
> And then there was the problem that the display list wasn't stored.
> Bye
> Sven
> diff -ru ../z.old/Src/Zle/compctl.c Src/Zle/compctl.c
> --- ../z.old/Src/Zle/compctl.c Thu Feb 24 09:54:17 2000
> +++ Src/Zle/compctl.c Thu Feb 24 10:32:41 2000
> @@ -3763,10 +3763,11 @@
> for (ln = firstnode(matches); ln; ln = nextnode(ln)) {
> m = (Cmatch) getdata(ln);
> if (m->ppre) {
> + char *s = (m->psuf ? m->psuf : "");
> char *p = (char *) zhalloc(strlen(m->ppre) + strlen(m->str) +
> - strlen(m->psuf) + 1);
> + strlen(s) + 1);
> - sprintf(p, "%s%s%s", m->ppre, m->str, m->psuf);
> + sprintf(p, "%s%s%s", m->ppre, m->str, s);
> addlinknode(args, dupstring(p));
> } else
> addlinknode(args, dupstring(m->str));
> @@ -3799,6 +3800,9 @@
> endcmgroup(yaptr);
> begcmgroup("default", 0);
> }
> + } else {
> + endcmgroup(yaptr);
> + begcmgroup("default", 0);
> }
> } else if ((tt = cc->explain)) {
> tt = dupstring(tt);
> --
> Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 3+ messages in thread
* segfault in 3.1.6 in completion
@ 2000-02-24 0:34 Greg Klanderman
0 siblings, 0 replies; 3+ messages in thread
From: Greg Klanderman @ 2000-02-24 0:34 UTC (permalink / raw)
To: Zsh list
Please copy me in any replies.
Start 3.1.6 with no init files and load the below attached completion
functions. Now if you go into a directory containing CVS controlled
files and try
% cvstest foobar/
(where foobar is some directory) and hit TAB you get a crash
Program received signal SIGSEGV, Segmentation fault.
#0 0x809fc6d in makecomplistflags ()
#1 0x809d53b in makecomplistlist ()
#2 0x809d4bf in makecomplistor ()
#3 0x809d43a in makecomplistcc ()
#4 0x809d362 in makecomplistcmd ()
#5 0x809d1e1 in makecomplistglobal ()
#6 0x809bea3 in makecomplist ()
#7 0x809abb8 in docompletion ()
#8 0x80949f3 in docomplete ()
#9 0x809398e in expandorcomplete ()
#10 0x808d67c in execzlefunc ()
#11 0x808d3d6 in zleread ()
#12 0x8063e7d in inputline ()
#13 0x8063dc5 in ingetc ()
#14 0x805f6a9 in ihgetc ()
#15 0x80674e7 in gettok ()
#16 0x8066ffe in yylex ()
#17 0x8071d3c in parse_event ()
#18 0x8062601 in loop ()
#19 0x804a73a in main ()
Unfortunately I didn't build with debugging on and don't have time
right now. Figured I'd send this first just in case it's already been
fixed..
If there is no directory (ie complete file in current directory), or
if you disable the "-y _cvscompletions", it works fine.
thanks,
Greg
# mostly stolen from the zsh distribution
compctl -/K _cvstargets -y _cvscompletions cvstest
_cvsprefix () {
local nword args f
read -nc nword; read -Ac args
pref=$args[$nword]
if [[ -d $pref:h && ! -d $pref ]]; then
pref=$pref:h
elif [[ $pref != */* ]]; then
pref=
fi
[[ -n "$pref" && "$pref" != */ ]] && pref=$pref/
}
_cvsentries () {
setopt localoptions nullglob unset
if [[ -f ${pref}CVS/Entries ]]; then
reply=( "${pref}${^${(@)${(@)${(@)${(f@)$(<${pref}CVS/Entries)}:#D*}#/}%%/*}[@]}" )
fi
}
_cvscompletions () {
setopt localoptions noksharrays
local c cc
reply=( )
for c in $@ ; do
cc="${c##*/}"
[[ -d "$c" ]] && cc="$cc/"
reply=( $reply[@] $cc )
done
}
_cvstargets () {
setopt localoptions noksharrays
local pref
_cvsprefix
_cvsentries
}
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2000-02-24 16:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-02-24 9:36 segfault in 3.1.6 in completion Sven Wischnowsky
2000-02-24 16:37 ` Greg Klanderman
-- strict thread matches above, loose matches on Subject: below --
2000-02-24 0:34 Greg Klanderman
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).