From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13709 invoked by alias); 16 Apr 2017 16:29: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: 40979 Received: (qmail 12592 invoked from network); 16 Apr 2017 16:29:56 -0000 X-Qmail-Scanner-Diagnostics: from kahlil.inlv.org by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(37.59.109.123):SA:0(-0.0/5.0):. Processed in 1.784585 secs); 16 Apr 2017 16:29:56 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RP_MATCHES_RCVD autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: martijn@inlv.org X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at inlv.org does not designate permitted sender hosts) To: zsh-workers@zsh.org From: Martijn Dekker Subject: Alias expansion inconsistency in $(command substitutions) with IGNORE_CLOSE_BRACES Message-ID: <131b162a-b1f8-998c-e5ca-6a161dfef16f@inlv.org> Date: Sun, 16 Apr 2017 17:07:09 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit If either the IGNORE_CLOSE_BRACES or IGNORE_BRACES option is active, there is an inconsistency in alias expansion within command substitutions, specifically those of the form $(command). Given: % set -o ignoreclosebraces % alias OPEN='{' CLOSE='};' These work fine: % { OPEN echo hi; CLOSE } hi % var=`{ OPEN echo hi; CLOSE }` && echo "$var" hi But this does not: % var=$({ OPEN echo hi; CLOSE }) && echo "$var" zsh: parse error near `)' zsh: parse error near `var=$({ OPEN echo hi...' This inconsistency seems to have been introduced around zsh 5.2; it's not present in zsh 5.1.1 and earlier. Thanks, - M. In case anyone wonders about an actual use case for aliases like these, it's the var/setlocal module of modernish, my cross platform POSIX shell library: https://github.com/modernish/modernish#user-content-use-varsetlocal This basically brings the functionality of zsh anonymous functions to plain POSIX shells. Of course this would be redundant on scripts written for zsh, but it would be nice if cross-shell scripts run consistently.