Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Id: Zsh Workers List <zsh-workers.zsh.org>
List-Post: <mailto:zsh-workers@zsh.org>
List-Help: <mailto:zsh-workers-help@zsh.org>
X-Qmail-Scanner-Diagnostics: from know-smtprelay-omc-5.server.virginmedia.net by f.primenet.com.au (envelope-from <p.w.stephenson@ntlworld.com>, uid 7791) with qmail-scanner-2.11 
 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1.  
 Clear:RC:0(80.0.253.69):SA:0(-0.0/5.0):. 
 Processed in 0.128907 secs); 08 Aug 2016 18:33:17 -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=SPF_PASS
	autolearn=unavailable autolearn_force=no version=3.4.1
X-Envelope-From: p.w.stephenson@ntlworld.com
X-Qmail-Scanner-Mime-Attachments: |
X-Qmail-Scanner-Zip-Files: |
Received-SPF: pass (ns1.primenet.com.au: SPF record at _smtprelay.virginmedia.com designates 80.0.253.69 as permitted sender)
X-Originating-IP: [86.21.161.213]
X-Spam: 0
X-Authority: v=2.1 cv=HZrpNXw8 c=1 sm=1 tr=0 a=oo3MgO7t/4XyXFuSzI3dDQ==:117
 a=oo3MgO7t/4XyXFuSzI3dDQ==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10
 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=pGLkceISAAAA:8 a=TSckgMUDdtXBa70M3kcA:9
 a=CjuIK1q_8ugA:10 a=6kGIvZw6iX1k4Y-7sg4_:22
Date: Mon, 8 Aug 2016 19:27:34 +0100
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-workers@zsh.org
Subject: Re: [bug] shwordsplit not working on $@ when $# > 1
Message-ID: <20160808192734.21923640@ntlworld.com>
In-Reply-To: <20160808111626.GA19766@chaz.gmail.com>
References: <20160808111626.GA19766@chaz.gmail.com>
X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.28; x86_64-redhat-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
X-Seq: zsh-workers 39006

On Mon, 8 Aug 2016 12:16:26 +0100
Stephaneo Chazelas <stephane.chazelas@gmail.com> wrote:
> It looks like the elements of $@ only undergo splitting when $#
> is 1:
> 
> ~$ zsh -o shwordsplit -c 'IFS=:; echo $@' zsh a:b
> a b
> ~$ zsh -o shwordsplit -c 'IFS=:; echo $@' zsh a:b c
> a:b c

The variable isarr from the value entry v->isarr is negative, so we
don't go into the loop that does joining and splitting as that
explicitly asks for (isarr >= 0).  (It was 0 for a scalar, hence the
first case above.)

Setting this negative is apparently deliberate:

/* "$foo[@]"-style substitution
 * Only sign bit is significant
 */
#define SCANPM_ISVAR_AT   ((int)(((unsigned int)-1)<<15))

This seems to conflict with the use of isarr in paramsubst(); that's
documented but I think only because I tried to decode the code.  I don't
know what this SCANPM_ISVAR_AT is doing.  Perhaps it needs converting to
something else at some point?

pws

