From 6f93994a5aeb3a8290153ec159af35bbd96a6673 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Wed, 29 Feb 2012 09:57:40 +0000 Subject: 30299: "$*" was split with SHWORDSPLIT if IFS was empty or unset --- ChangeLog | 9 +++++++-- Src/subst.c | 2 +- Test/D04parameter.ztst | 10 ++++++++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6673aeba0..b1d8ce9d4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2012-02-29 Peter Stephenson + + * 30299: Src/subst.c, Test/D04parameter.ztst: "$*" was split + in SHWORDSPLIT if IFS was unset or empty. + 2012-02-26 Peter Stephenson * Alexey I. Froloff: 30270: Test/C02Cond.ztst: we don't care @@ -19,7 +24,7 @@ 2012-02-20 Barton E. Schaefer - * 30242: Src/subst.c, Test/D05parameter.ztst: use PREFORK_SINGLE + * 30242: Src/subst.c, Test/D04parameter.ztst: use PREFORK_SINGLE for the right-hand side of ${...=...} when SH_WORD_SPLIT is in effect (POSIX emulation). @@ -16020,5 +16025,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5596 $ +* $Revision: 1.5597 $ ***************************************************** diff --git a/Src/subst.c b/Src/subst.c index b9229861b..04ef1a4fb 100644 --- a/Src/subst.c +++ b/Src/subst.c @@ -1649,7 +1649,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags) * This is one of the things that decides whether multsub * will produce an array, but in an extremely indirect fashion. */ - int nojoin = (pf_flags & PREFORK_SHWORDSPLIT) ? !(ifs && *ifs) : 0; + int nojoin = (pf_flags & PREFORK_SHWORDSPLIT) ? !(ifs && *ifs) && !qt : 0; /* * != 0 means ${...}, otherwise $... What works without braces * is largely a historical artefact (everything works with braces, diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst index 7eb721226..8bc37ff4c 100644 --- a/Test/D04parameter.ztst +++ b/Test/D04parameter.ztst @@ -1475,3 +1475,13 @@ print ${#foo} 0:Nularg removed from split empty string >0 + + (set -- a b c + setopt shwordsplit + IFS= + print -rl "$*" + unset IFS + print -rl "$*") +0:Regression test for shwordsplit with null or unset IFS and quoted array +>abc +>a b c -- cgit 1.4.1