Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: capturing output of !! not working
- X-seq: zsh-workers 34742
- From: Peter Stephenson <p.stephenson@xxxxxxxxxxx>
- To: Zsh Hackers' List <zsh-workers@xxxxxxx>
- Subject: Re: capturing output of !! not working
- Date: Thu, 19 Mar 2015 10:57:16 +0000
- In-reply-to: <CACeGjnXH=Dk6eAv0OEfyT99RC9J=AMiyxL4wT4p_SVS1pLo0+g@mail.gmail.com>
- 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
- Organization: Samsung Cambridge Solution Centre
- References: <CACeGjnXH=Dk6eAv0OEfyT99RC9J=AMiyxL4wT4p_SVS1pLo0+g@mail.gmail.com>
On Wed, 18 Mar 2015 21:49:37 -0400
Vin Shelton <acs@xxxxxxxxxxxxxxxxxxxx> wrote:
> $ ls -l $(!!)
> ls -l $()
This is due to special code for handling aliases inside command
substitutions that got applied too widely because the flag that
indicates aliases also indicates history expansion; however, there's a
discriminator in another bit. I suspect restricting application of
INP_ALIAS is a better fix overall, but it needs a lot more code tracking
down plus safety checks.
Another case where we need a framework for testing interactive shells.
pws
diff --git a/Src/hist.c b/Src/hist.c
index aa07ce8..b7ef522 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -338,7 +338,8 @@ ihwaddc(int c)
* fashion as we never need the expansion in the history
* line, only in the lexer and above.
*/
- !((histactive & HA_INWORD) && (inbufflags & INP_ALIAS))) {
+ !((histactive & HA_INWORD) &&
+ (inbufflags & (INP_ALIAS|INP_HIST)) == INP_ALIAS)) {
/* Quote un-expanded bangs in the history line. */
if (c == bangchar && stophist < 2 && qbang)
/* If qbang is not set, we do not escape this bangchar as it's *
@@ -901,7 +902,8 @@ ihungetc(int c)
zlemetall--;
exlast++;
}
- if (!(histactive & HA_INWORD) || !(inbufflags & INP_ALIAS)) {
+ if (!(histactive & HA_INWORD) ||
+ (inbufflags & (INP_ALIAS|INP_HIST)) != INP_ALIAS) {
DPUTS(hptr <= chline, "BUG: hungetc attempted at buffer start");
hptr--;
DPUTS(*hptr != (char) c, "BUG: wrong character in hungetc() ");
Messages sorted by:
Reverse Date,
Date,
Thread,
Author