zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers <zsh-workers@zsh.org>
Subject: Re: [BUG] Alias with unclosed quote leaves incorrect string in history
Date: Sat, 7 Mar 2015 14:48:48 -0800	[thread overview]
Message-ID: <150307144848.ZM17264@torch.brasslantern.com> (raw)
In-Reply-To: <5524431425766277@web26o.yandex.ru>

On Mar 8,  1:11am, ZyX wrote:
}
} % alias -g S='"'
} % echo S abc def S
} dquote> "
}  abc def S
} % echo S" abc def S
} "
} 
} which is the original string + a quote after first `S` which is wrong.

This is probably related to the bug with aliasing of "{" that I reported
as an afterthought in workers/34668.

} Second S also does not end the string, but I do not think this is a bug.

It's related to the way zsh mixes lexical analysis with alias expansion.
By the time you get to the second S, the first S has already expanded to
a double quote so the second S is quoted.

} Same thing will happen if I e.g. have unclosed `$(` or `'` in an
} alias. I think it is more correct to deal with this problem by
} errorring out when user tries to use such an alias.

There probably isn't any good way to do that.  It would require that we
treat the expansion of an alias as something to be lexed separately,
rather than treating it as having been pushed onto the input.


      reply	other threads:[~2015-03-07 22:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-07 22:11 ZyX
2015-03-07 22:48 ` Bart Schaefer [this message]

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=150307144848.ZM17264@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /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).