Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Completion in empty double-quotes generates error
- X-seq: zsh-workers 38229
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: Completion in empty double-quotes generates error
- Date: Fri, 1 Apr 2016 18:18:24 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=p76yJ/varFZCYL8LOuDyw/2T4zCgLGYIquq1lJwjqT8=; b=CyTmToLUnhav2jho60IyzSPVgL9sP0LhhqhJ+FXDIBKbABaU3FSBfwqz7zUl2XpQI9 Bxju6AXTiIuNRVoVP+nSJ7BAk5DdqaOV7ptnDCy6Ziq945e06l6fj1amx4zcZRxo5604 UqfWg7aAWAtGnhN8p8PJT9luOvndMlvivKa7fWDqQQJ/DDFj0pt2nGoP2H5VyvNIZbTL KlLbix3W8ZWrKqtWxxbHogTeBwdemNC0l4ribMkLMBmojjZl8DAzjvlE8xuiQE+CgE3z HGt9NU1xZYoBCf6SEjVK1TZCzw7NR+9jN916+gHwNiH+TyPdEo6VSJibHLYeViMe7zOX KHvA==
- In-reply-to: <20160401053633.GA17993@tarsus.local2>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <160330110652.ZM1432@torch.brasslantern.com> <20160401053633.GA17993@tarsus.local2>
On Apr 1, 5:36am, Daniel Shahaf wrote:
} Subject: Re: Completion in empty double-quotes generates error
}
} Bart Schaefer wrote on Wed, Mar 30, 2016 at 11:06:52 -0700:
} > torch% ls ""<backward-char><complete-word>
} > torch% ls " ../../../zsh-5.0/Src/Zle/zle_tricky.c:658: BUG: 0 <= wb (3) <= zlemetacs (2) <= we (3) is not true!
} > ls ""
} >
} > If there is even one other character inside the quotes before completing, no
} > error is reported.
}
} I ran into this six months ago in 37012
I'm not confident this is the same bug, even though the DPUTS() which
trips is the same one.
} there the reproducer was:
}
} % : 2>1<backward-char><backward-char><<backward-char><complete-word>
} zle_tricky.c:658: BUG: 0 <= wb (4) <= zlemetacs (2) <= we (5) is not true!
I can't reproduce this any longer, at least not with plain compinit and
no zstyles.
In the empty-parens case, "wb" is set to the position of the first
double-quote and "we" is set to just after the second double-quote.
This happens in gotword() called from the lexer from get_comp_string()
at line 1202, via exalias().
Still in get_comp_string(), we then fall into the for-loop commented
/* While building the quoted form, we also clean up the command line. */
This loop deletes the double quotes with foredel() at line 1851, and
decrements we, but never adjusts wb even though the double-quote
at which it points is being deleted. There's a similar thing with
backdel() in another branch, which presumably could be the 37021 bug,
but I don't know how to trigger it any more.
However, if I try what I think is obvious and set wb = zlemetacs then
the space before the double-quotes gets deleted and never restored.
So either it's not really a problem for zlemetacs to be less than wb,
or the following is correct (and I suppose its possible we need the
same test for wb > we, but I can't make that happen, so I'm leaving
it for now).
diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index a89b2a3..b1709c1 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -1849,8 +1849,12 @@ get_comp_string(void)
ocs = zlemetacs;
zlemetacs = i;
foredel(skipchars, CUT_RAW);
- if ((zlemetacs = ocs) > --i)
+ if ((zlemetacs = ocs) > --i) {
zlemetacs -= skipchars;
+ /* do not skip past the beginning of the word */
+ if (wb > zlemetacs)
+ zlemetacs = wb;
+ }
we -= skipchars;
}
} else {
@@ -1861,6 +1865,9 @@ get_comp_string(void)
zlemetacs = we - skipchars;
else
zlemetacs = ocs;
+ /* do not skip past the beginning of the word */
+ if (wb > zlemetacs)
+ zlemetacs = wb;
we -= skipchars;
}
/* we need to get rid of all the quotation bits... */
Messages sorted by:
Reverse Date,
Date,
Thread,
Author