Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: regression in "$*" expansion
On Mon, 27 Feb 2012 20:24:56 +0000
Stephane Chazelas <stephane_chazelas@xxxxxxxx> wrote:
> $ ARGV0=sh zsh -c 'IFS=; print -rl "$*"' x a b c
> a
> b
> c
>
> (instead of expected "abc").
I don't really understand the nojoin flag (in the sense of "I never
really understood string theory") but it shouldn't be doing anything
related to SHWORDSPLIT within quotes, unless we're explicitly using (@)
or $@ which we haven't tested at this point. So I think the fix is
just this local change.
Index: Src/subst.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/subst.c,v
retrieving revision 1.132
diff -p -u -r1.132 subst.c
--- Src/subst.c 20 Feb 2012 17:50:40 -0000 1.132
+++ Src/subst.c 28 Feb 2012 10:23:11 -0000
@@ -1649,7 +1649,7 @@ paramsubst(LinkList l, LinkNode n, char
* 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,
Index: Test/D04parameter.ztst
===================================================================
RCS file: /cvsroot/zsh/zsh/Test/D04parameter.ztst,v
retrieving revision 1.62
diff -p -u -r1.62 D04parameter.ztst
--- Test/D04parameter.ztst 22 Feb 2012 15:35:50 -0000 1.62
+++ Test/D04parameter.ztst 28 Feb 2012 10:23:11 -0000
@@ -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
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK
Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog
Messages sorted by:
Reverse Date,
Date,
Thread,
Author