zsh-workers
 help / color / mirror / code / Atom feed
* Re: Bug#466655: the expression {x=(); echo ${+x[(r)blah]}} changes meaning between 4.3.2 and current version
       [not found] <20080220070905.7276.65390.reportbug@localhost.localdomain>
@ 2008-02-27 14:35 ` Clint Adams
  2008-02-27 15:29   ` Peter Stephenson
  2008-02-27 16:50   ` Frederik Eaton
  0 siblings, 2 replies; 3+ messages in thread
From: Clint Adams @ 2008-02-27 14:35 UTC (permalink / raw)
  To: Frederik Eaton, 466655; +Cc: zsh-workers

On Wed, Feb 20, 2008 at 07:09:05AM +0000, Frederik Eaton wrote:
> Hello, one of my scripts has broken because of the following change:
> 
> $ zsh --version
> zsh 4.3.2 (i686-pc-linux-gnu)
> $ x=(); echo ${+x[(r)blah]}
> 0
> 
> $ zsh --version
> zsh 4.3.5 (i686-pc-linux-gnu)
> $ x=(); echo ${+x[(r)blah]}
> 1
> 
> Is the behaviour of zsh's parameter expansion supposed to be stable?

I think this is related to 23273*

* http://www.zsh.org/mla/workers/2007/msg00194.html


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Bug#466655: the expression {x=(); echo ${+x[(r)blah]}} changes meaning between 4.3.2 and current version
  2008-02-27 14:35 ` Bug#466655: the expression {x=(); echo ${+x[(r)blah]}} changes meaning between 4.3.2 and current version Clint Adams
@ 2008-02-27 15:29   ` Peter Stephenson
  2008-02-27 16:50   ` Frederik Eaton
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Stephenson @ 2008-02-27 15:29 UTC (permalink / raw)
  To: zsh-workers; +Cc: 466655

On Wed, 27 Feb 2008 09:35:40 -0500
Clint Adams <schizo@debian.org> wrote:
> On Wed, Feb 20, 2008 at 07:09:05AM +0000, Frederik Eaton wrote:
> > Hello, one of my scripts has broken because of the following change:
> > 
> > $ zsh --version
> > zsh 4.3.2 (i686-pc-linux-gnu)
> > $ x=(); echo ${+x[(r)blah]}
> > 0
> > 
> > $ zsh --version
> > zsh 4.3.5 (i686-pc-linux-gnu)
> > $ x=(); echo ${+x[(r)blah]}
> > 1
> > 
> > Is the behaviour of zsh's parameter expansion supposed to be stable?
> 
> I think this is related to 23273*

No, this is unexpected fallout from the changes to make zero subscripts
behave in a more rational fashion, 23562.  I hadn't even remembered this
form worked with subscripts, but the the manual certainly suggests it
should (and it's definitely useful).  I've added a test that should keep it
working.

Index: Src/subst.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/subst.c,v
retrieving revision 1.82
diff -u -r1.82 subst.c
--- Src/subst.c	16 Dec 2007 14:05:16 -0000	1.82
+++ Src/subst.c	27 Feb 2008 15:28:41 -0000
@@ -1915,7 +1915,8 @@
 			     hkeys|hvals|
 			     (arrasg ? SCANPM_ASSIGNING : 0)|
 			     (qt ? SCANPM_DQUOTED : 0))) ||
-	    (v->pm && (v->pm->node.flags & PM_UNSET)))
+	    (v->pm && (v->pm->node.flags & PM_UNSET)) ||
+	    (v->flags & VALFLAG_EMPTY))
 	    vunset = 1;
 
 	if (wantt) {
Index: Test/D04parameter.ztst
===================================================================
RCS file: /cvsroot/zsh/zsh/Test/D04parameter.ztst,v
retrieving revision 1.29
diff -u -r1.29 D04parameter.ztst
--- Test/D04parameter.ztst	30 Oct 2007 14:01:35 -0000	1.29
+++ Test/D04parameter.ztst	27 Feb 2008 15:28:41 -0000
@@ -52,6 +52,14 @@
 0:$+...
 >1 1 0 0
 
+  x=()
+  print ${+x} ${+x[1]} ${+x[(r)foo]} ${+x[(r)bar]}
+  x=(foo)
+  print ${+x} ${+x[1]} ${+x[(r)foo]} ${+x[(r)bar]}
+0:$+... with arrays
+>1 0 0 0
+>1 1 1 0
+
   set1=set1v
   null1=
   print ${set1:-set1d} ${set1-set2d} ${null1:-null1d} ${null1-null2d} x

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Bug#466655: the expression {x=(); echo ${+x[(r)blah]}} changes meaning between 4.3.2 and current version
  2008-02-27 14:35 ` Bug#466655: the expression {x=(); echo ${+x[(r)blah]}} changes meaning between 4.3.2 and current version Clint Adams
  2008-02-27 15:29   ` Peter Stephenson
@ 2008-02-27 16:50   ` Frederik Eaton
  1 sibling, 0 replies; 3+ messages in thread
From: Frederik Eaton @ 2008-02-27 16:50 UTC (permalink / raw)
  To: 466655, zsh-workers

Hello Clint,

Thanks for the reply, are you suggesting that 23273 fixed a previous
bug or introduced a new bug?

Frederik

On Wed, Feb 27, 2008 at 09:35:40AM -0500, Clint Adams wrote:
> On Wed, Feb 20, 2008 at 07:09:05AM +0000, Frederik Eaton wrote:
> > Hello, one of my scripts has broken because of the following change:
> > 
> > $ zsh --version
> > zsh 4.3.2 (i686-pc-linux-gnu)
> > $ x=(); echo ${+x[(r)blah]}
> > 0
> > 
> > $ zsh --version
> > zsh 4.3.5 (i686-pc-linux-gnu)
> > $ x=(); echo ${+x[(r)blah]}
> > 1
> > 
> > Is the behaviour of zsh's parameter expansion supposed to be stable?
> 
> I think this is related to 23273*
> 
> * http://www.zsh.org/mla/workers/2007/msg00194.html
> 

-- 
http://ofb.net/~frederik/


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-02-27 17:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20080220070905.7276.65390.reportbug@localhost.localdomain>
2008-02-27 14:35 ` Bug#466655: the expression {x=(); echo ${+x[(r)blah]}} changes meaning between 4.3.2 and current version Clint Adams
2008-02-27 15:29   ` Peter Stephenson
2008-02-27 16:50   ` Frederik Eaton

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).