summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Src/subst.c3
-rw-r--r--Test/D04parameter.ztst8
3 files changed, 15 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 3a0c3df1a..cd6bc0138 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-02-27 Peter Stephenson <pws@csr.com>
+
+ * 24611: Src/subst.c, Test/D04parameter.ztst: 23562
+ broke the case of ${+array[...]} for an empty range match.
+
2008-02-26 Peter Stephenson <p.w.stephenson@ntlworld.com>
* 24602: Test/C02cond.ztst: failing to run a test didn't
diff --git a/Src/subst.c b/Src/subst.c
index 22b4cfe08..9df448fc9 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -1915,7 +1915,8 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
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) {
diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst
index e8718a691..6775803a7 100644
--- a/Test/D04parameter.ztst
+++ b/Test/D04parameter.ztst
@@ -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