Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: loving zsh, crashing zsh...
- X-seq: zsh-users 14307
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: loving zsh, crashing zsh...
- Date: Sat, 15 Aug 2009 17:38:29 +0100
- In-reply-to: <f950edef0908130341k4824035do93d37a77801ff429@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <f950edef0908130340s3ede9ec3hfdfe5626574a7485@xxxxxxxxxxxxxx> <f950edef0908130341k4824035do93d37a77801ff429@xxxxxxxxxxxxxx>
On Thu, 13 Aug 2009 12:41:21 +0200
Francisco Borges <francisco.borges@xxxxxxxxx> wrote:
> I was annoyed by the evaluation of an if in a script, went to play
> with it in the command line, and found this cute segfault.
(Bugs should go to zsh-workers, not zsh-users, unless you want to point
out a workaround people can use, or something like that.)
> Â~ % if [[ -e /etc ]] { echo "\nNow I'll go back to the '/etc' in the
> if,\nDelete the c in it, hit TAB for completion.\nThis will crash the
> shell\n\n" }
>
> Now I'll go back to the '/etc' in the if,
> Delete the c in it, hit TAB for completion.
> This will crash the shell
>...
> Some years ago I had found another way to crash Zsh and upon posting
> it, someone answered back by saying something like "you're not
> supposed to do that". Yeah right. Just watch me :-P
There's nothing to stop you doing that, and it should even work, but the
special zsh syntax for tests and loops is a bit tricky to handle.
Index: Src/Zle/zle_tricky.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_tricky.c,v
retrieving revision 1.99
diff -u -r1.99 zle_tricky.c
--- Src/Zle/zle_tricky.c 20 Feb 2009 21:49:58 -0000 1.99
+++ Src/Zle/zle_tricky.c 15 Aug 2009 16:25:16 -0000
@@ -1211,7 +1211,15 @@
(ins == 2 && i == 2) || (ins == 3 && i == 3) ||
tok == BAR || tok == AMPER ||
tok == BARAMP || tok == AMPERBANG ||
- ((tok == DBAR || tok == DAMPER) && !incond)) {
+ ((tok == DBAR || tok == DAMPER) && !incond) ||
+ /*
+ * Special case: we might reach a new command (incmdpos set)
+ * if we've already found the string we're completing (tt set)
+ * without hitting one of the above if we're using one of
+ * the special zsh forms of delimiting for conditions and
+ * loops that I really loathe having to support.
+ */
+ (tt && incmdpos)) {
/* This is one of the things that separate commands. If we *
* already have the things we need (e.g. the token strings), *
* leave the loop. */
--
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/
Messages sorted by:
Reverse Date,
Date,
Thread,
Author