Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Bug with bash emulation regarding ':'



On Tue, 14 Feb 2012 18:30:21 -0500
Chet Ramey <chet.ramey@xxxxxxxx> wrote:
> Bash doesn't split word in ${parameter:OPword} because Posix says not
> to:
>..
> The same thing actually happens in both examples; you just look at the
> results of the expansion in the second case.  The rhs gets expanded,
> but not split, assigned to test_split_var, and that becomes the result
> of the parameter expansion.  Those results get split, since the param
> expansion doesn't occur within double quotes, and passed to `:' and echo
> as arguments.

Thanks, that's along the lines I supposed but more detailed.

To get this behaviour in zsh we'd have to do the assignment earlier
than we currently do.  The assignments around line 2705 of subst.c would
need to buried inside multsub() in such a way that any splitting owing to
the top-level settings happened later --- which is very difficult since
we rely on the nested substitution to do the splitting we see in the
top-level parameter expansion because it parses it so knows how to split
it.  Whether there are remaining gotchas owing to ordering I don't know.

Yuk.

-- 
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