From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: PATCH: Completion/matching control problem
Date: Mon, 2 Aug 1999 13:28:06 +0200 (MET DST) [thread overview]
Message-ID: <199908021128.NAA12989@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: Felix Rosencrantz's message of Wed, 28 Jul 1999 10:47:17 -0700 (PDT)
Felix Rosencrantz wrote:
> Here's a problem with matching control that I encountered. I've been
> meaning to send this patch in for some time. If I understood the code
> better, I think I provide a cleaner test case.
>
> mkdir bug
> cd bug
> touch Abc-Def-Ghij.txt
> touch Abc-def.ghi.jkl_mno.pqr.txt
> touch Abc_def_ghi_jkl_mno_pqr.txt
> compctl -M 'm:{a-z}={A-Z} r:|[.,_-]=*'
> ls a-a<TAB>
>
> I sometimes see either a hang or a core dump.
>
> The problem seems to occur when match_str is called with test=1 and abort_match
> is called, the globals matchparts&matchsubs end up pointing to free'd clines,
> which causes problems for code that attempts to append clines to the list.
It shouldn't call abort_match() at all when doing only testing (which
happens when it calls itself recursively while trying to match *-patterns).
> I another problem is if you type:
> ls a<TAB>
> you get:
> ls Abcdefghi
> which doesn't seem correct, but I figure someone who understands the code might
> be able to fix this one.
After trying word-strings and seeing that they didn't match it
compared line-strings even if they were empty (i.e. if it were in a
part of the matches that didn't have anything matching it on the
line). It should do that only at the end of the matches (which is
represented by a cline struct with an empty anchor).
That new place where CLF_MISS is set is needed to get the
cursor-placement right when the cline list was truncated.
Bye
Sven
diff -u os/Zle/zle_tricky.c Src/Zle/zle_tricky.c
--- os/Zle/zle_tricky.c Mon Aug 2 13:00:10 1999
+++ Src/Zle/zle_tricky.c Mon Aug 2 13:21:55 1999
@@ -2542,9 +2542,12 @@
lm = NULL;
} else {
/* No matcher and different characters: l does not match w. */
+ if (test)
+ return 0;
+
abort_match();
- return (test ? 0 : -1);
+ return -1;
}
}
/* If this is a recursive call, we just return if l matched w or not. */
@@ -2907,7 +2910,7 @@
/* First try the exact strings. */
if ((!(o->flags & CLF_LINE) && o->wlen == n->wlen &&
(!o->word || !strncmp(o->word, n->word, o->wlen))) ||
- (line = ((!o->line && !n->line) ||
+ (line = ((!o->line && !n->line && !o->wlen && !n->wlen) ||
(o->llen == n->llen && o->line && n->line &&
!strncmp(o->line, n->line, o->llen))))) {
if (line) {
@@ -3434,6 +3437,7 @@
o->wlen = 0;
free_cline(o->next);
o->next = NULL;
+ o->flags |= CLF_MISS;
}
}
/* Ok, they are equal, now join the sub-lists. */
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
next reply other threads:[~1999-08-02 11:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-08-02 11:28 Sven Wischnowsky [this message]
-- strict thread matches above, loose matches on Subject: below --
1999-08-02 12:50 Sven Wischnowsky
1999-08-02 12:36 Sven Wischnowsky
1999-07-28 17:47 Felix Rosencrantz
1999-07-29 8:03 ` Peter Stephenson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=199908021128.NAA12989@beta.informatik.hu-berlin.de \
--to=wischnow@informatik.hu-berlin.de \
--cc=zsh-workers@sunsite.auc.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).