Bug#466655: the expression {x=(); echo ${+x[(r)blah]}} changes meaning between 4.3.2 and current version

2008-02-27 Thread Peter Stephenson
On Wed, 27 Feb 2008 09:35:40 -0500
Clint Adams [EMAIL PROTECTED] wrote:
 On Wed, Feb 20, 2008 at 07:09:05AM +, 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 -  1.82
+++ Src/subst.c 27 Feb 2008 15:28:41 -
@@ -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 -  1.29
+++ Test/D04parameter.ztst  27 Feb 2008 15:28:41 -
@@ -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 [EMAIL PROTECTED]  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK  Tel: +44 (0)1223 692070



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#466655: the expression {x=(); echo ${+x[(r)blah]}} changes meaning between 4.3.2 and current version

2008-02-27 Thread Frederik Eaton
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 +, 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/



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#466655: the expression {x=(); echo ${+x[(r)blah]}} changes meaning between 4.3.2 and current version

2008-02-27 Thread Clint Adams
On Wed, Feb 20, 2008 at 07:09:05AM +, 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



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#466655: the expression {x=(); echo ${+x[(r)blah]}} changes meaning between 4.3.2 and current version

2008-02-19 Thread Frederik Eaton
Package: zsh
Version: 4.3.5-2
Severity: normal

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?

Thanks,

Frederik

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 
'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.22-1-686 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages zsh depends on:
ii  libc6 2.7-6  GNU C Library: Shared libraries
ii  libcap1   1:1.10-14  support for getting/setting POSIX.
ii  libncursesw5  5.6+20080105-1 Shared libraries for terminal hand

Versions of packages zsh recommends:
ii  libpcre3  7.4-1  Perl 5 Compatible Regular Expressi

-- no debconf information



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]