From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=DKIM_ADSP_ALL, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=no autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id c2d6e8e3 for ; Tue, 24 Dec 2019 20:34:57 +0000 (UTC) Received: (qmail 13277 invoked by alias); 24 Dec 2019 20:34:50 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 24575 Received: (qmail 17093 invoked by uid 1010); 24 Dec 2019 20:34:49 -0000 X-Qmail-Scanner-Diagnostics: from mx.spodhuis.org by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.1/25670. spamassassin: 3.4.2. Clear:RC:0(94.142.241.89):SA:0(-4.3/5.0):. Processed in 1.591588 secs); 24 Dec 2019 20:34:49 -0000 X-Envelope-From: zsh-workers+phil.pennock@spodhuis.org X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at spodhuis.org designates 94.142.241.89 as permitted sender) Date: Tue, 24 Dec 2019 15:34:08 -0500 From: Phil Pennock To: Daniel Shahaf Cc: zsh-users@zsh.org Subject: Re: ${(z)} parsing of multiple array assignments Message-ID: <20191224203408.GA35101@osmium.pennocktech.home.arpa> References: <20191223173115.bvhwbpfmqgqhngle@tarpaulin.shahaf.local2> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191223173115.bvhwbpfmqgqhngle@tarpaulin.shahaf.local2> OpenPGP: url=https://www.security.spodhuis.org/PGP/keys/0x4D1E900E14C1CC04.asc On 2019-12-23 at 17:31 +0000, Daniel Shahaf wrote: > In the following two cases, why are the assignments to $b > parsed differently to the assignments to $a? > > % pz() { print -rl -- ${(qqqq)${(z)1}} } Looks to be a bug, a lack of state reset. In two places, perhaps: you can see that one example resets when you alternate back away from having empty assignment lists, where the b/c pairing here is reset by `d`, so that the f/g pairing matches. But I can't trigger a reset to the initial parse state used for `a`; unless and until I introduce a newline, where in the second example you can see the same parse used for `e`: % echo $ZSH_VERSION 5.7.1 % x='a=(foo) b=() c=() d=(bar) e=(baz) f=() g=()' % print -rl -- "${(z)x}" a=( foo ) b= () c=( ) d=(bar) e=(baz) f= () g=( ) ## differs in $'...' not '...' and \n between d and e: % x=$'a=(foo) b=() c=() d=(bar)\ne=(baz) f=() g=()' % print -rl -- "${(z)x}" a=( foo ) b= () c=( ) d=(bar) ; e=( baz ) f= () g=( )