From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12266 invoked by alias); 18 Nov 2015 18:10:03 -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: 37145 Received: (qmail 29070 invoked from network); 18 Nov 2015 18:10:02 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.0 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:content-type; bh=ZZnrqgP3qSO5cxCTjmeQfxeHS9l2cDASqVYN7GmfXEk=; b=HlT7F40ZrJD3NtRwY3QTDe4Q/a/MksKYE+s6wFP0WlLYDsgfboQgkGQaW0Bva4Fv0L JYdZeWPE0qZITKxKXjaCXFdECxZKjX90bMjmbL8TaQ7eCLaeOhqtgWLOueUI+tF51UkU odHKYtGpXRfe1R3aIODRB/OM89KNERswJVk6vOYGBD4dCe5qaprNXrMWDdhuMHGKj8jq 4Z5HdsPfvghZxVwhS5Wlzn2tzCW+EdsJnREd7AXQWZVl/xuRHr881BCeFjHocGSoOV0Z uOYQJuxzV/y7iIzwC7EG5btDF8pCuswLrGM17eqSgeQ8muDrVuVqXnnoipWJDOQWl6pk CHuA== 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=ZZnrqgP3qSO5cxCTjmeQfxeHS9l2cDASqVYN7GmfXEk=; b=cgxxvqRgEAR6tGvXVE7EKWyAxuGjEsKOPJ1dLSCDoshai/Vq0mDAQcyrHZJfZt5p2R OupK9AxSlvCnxIEF02wOMhcyOWO8sFEKkutgMSorzWhp3RpqcT4T7pdGE3IumG+SxpTI LnSHUBC/8dOdiWGuqZALj1lgkA9cJTIb9UJqBHbSrq7TwHauU9kdxvVIQfnRALXX6awH Ii7lLJips9kg/3fq14o6wRa5NjEL7GHtGgWty/l5h/apGFnilGo5G1zQoo0c73qI1voq 501tFB0QGJkwAcIJnPnHVRPvBajsHhUirQJ8O9UepYru4SHPbIjYNjmOZSEjaowq/TDZ BhoA== X-Gm-Message-State: ALoCoQlfqkZQEQgQ0016JJJZDsUtjV254hasJMy45k9uWVFpSdGtBaN3rzOko/3PLYs6EYI9Rrb+ X-Received: by 10.68.249.68 with SMTP id ys4mr3978178pbc.124.1447870199860; Wed, 18 Nov 2015 10:09:59 -0800 (PST) From: Bart Schaefer Message-Id: <151118100958.ZM4522@torch.brasslantern.com> Date: Wed, 18 Nov 2015 10:09:58 -0800 In-Reply-To: <20151118161431.360006a5@pwslap01u.europe.root.pri> Comments: In reply to Peter Stephenson "Re: Bug in alias expansion" (Nov 18, 4:14pm) References: <20151115200356.0f3a80a2@ntlworld.com> <151115144805.ZM20614@torch.brasslantern.com> <20151118104254.4a46d326@pwslap01u.europe.root.pri> <20151118141323.04bda5aa@pwslap01u.europe.root.pri> <151118075246.ZM28042@torch.brasslantern.com> <20151118161431.360006a5@pwslap01u.europe.root.pri> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: Bug in alias expansion MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Nov 18, 4:14pm, Peter Stephenson wrote: } Subject: Re: Bug in alias expansion } } On Wed, 18 Nov 2015 07:52:46 -0800 } Bart Schaefer wrote: } > On Nov 18, 2:13pm, Peter Stephenson wrote: } > } Currently we expand both when parsing the entrails of the $(...) } > } and executing it, but should possibly only do so in the latter case. } > } I haven't look to see if this affects any tests. } > } > Would not-expanding affect cmd_or_math() adversely? Is that why we } > expand and then backtrack? } } I can't offhand think of a case. The crucial thing about cmd_or_math() } is to get the parentheses right. So it turns out that dquote_parse() has almost nothing to do with the bug (though probably still a lot to do with whether the aliases ought to expand at all); it's skipcomm() that causes the error. This small change fixes the problem seen in 37128: diff --git a/Src/lex.c b/Src/lex.c index 81904c1..0f260d0 100644 --- a/Src/lex.c +++ b/Src/lex.c @@ -2022,7 +2022,9 @@ skipcomm(void) int new_lexstop, new_lex_add_raw; int save_infor = infor; struct lexbufstate new_lexbuf; + int noalias = noaliases; + noaliases = 1; infor = 0; cmdpush(CS_CMDSUBST); SETPARBEGIN @@ -2140,6 +2142,7 @@ skipcomm(void) SETPAREND cmdpop(); infor = save_infor; + noaliases = noalias; return lexstop; #endif All "make check" tests still pass. And now: torch% alias -g foo='echo xyz)$(echo zyx' torch% print $(foo) zsh: parse error near `)' zsh: parse error in command substitution torch%