From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15016 invoked by alias); 7 Mar 2015 22:48:57 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 34683 Received: (qmail 15930 invoked from network); 7 Mar 2015 22:48:55 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version:content-type; bh=UCVe5TSNL/4lQ4TEE2pzFBrc3Jg/1WNjOhb0L9bb45E=; b=XyqHu2m/1nHc/Pr3lalBWJ2k/rwm0Sh3bzBxSoo1axZaccBeghMkkT0GnY51kobP3e OF78e255N7G8neXfO+Jqkp9p9gtS30SO/bsOKFexoayEYlUd01PkMN9KRdOOgOcIjtyB dgHJ/IwnZq5H8RNjiwJ6ZHzBW5LBM1m1ZsV3FGdQHgWCPwz4iTHqclX0zu88Pd+QlGWD TCbHlm75NeIDXieR55lfy4qcDT5DpBfVssV9n5zoIo9JvLNFkactzz/wh0e8eWGgdvzh zWQts2h7/5WjQ3PjyIwh7vGnfIRLBdnyBO5f8C6Qb/6PrK+nAdjuHsyc37POJoIZeqgB BDxw== X-Gm-Message-State: ALoCoQlB5cFAmVum3sGjHIEKTjsjGIxy6jcByzfMsYLOR7kqExj1CHa1AnL/uoFWLpn5VvAzZ3fM X-Received: by 10.182.248.161 with SMTP id yn1mr7715426obc.25.1425768531887; Sat, 07 Mar 2015 14:48:51 -0800 (PST) From: Bart Schaefer Message-Id: <150307144848.ZM17264@torch.brasslantern.com> Date: Sat, 7 Mar 2015 14:48:48 -0800 In-Reply-To: <5524431425766277@web26o.yandex.ru> Comments: In reply to ZyX "[BUG] Alias with unclosed quote leaves incorrect string in history" (Mar 8, 1:11am) References: <5524431425766277@web26o.yandex.ru> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers Subject: Re: [BUG] Alias with unclosed quote leaves incorrect string in history MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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.