From 0076d686645eb58256f2051a3f82136b9d70ea42 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Wed, 27 Feb 2008 15:51:26 +0000 Subject: 24611: fix ${+array[...]} for empty range --- ChangeLog | 5 +++++ Src/subst.c | 3 ++- Test/D04parameter.ztst | 8 ++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 3a0c3df1a..cd6bc0138 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-02-27 Peter Stephenson + + * 24611: Src/subst.c, Test/D04parameter.ztst: 23562 + broke the case of ${+array[...]} for an empty range match. + 2008-02-26 Peter Stephenson * 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 -- cgit 1.4.1