On Fri, Mar 04, 2016 at 11:29:38AM +0100, Dmitrij D. Czarkoff wrote:
> Martijn Dekker said:
> > So this patch makes quoted "$@" act according to the standard even when
> > IFS is empty. Quoted "$*" is unchanged. For the unspecified (not
> > standardised) cases of unquoted $@ and $*, this patch makes ksh act like
> > AT&T ksh93, bash, zsh and (d)ash, which seems safest from a
> > compatibility point of view.
>
> This makes sense to me, and changes seem reasonable. I've re-generated
> diff against -current. Anyone willing to OK it?
I think this is ok.
However, since this patch is rather subtle, it would be nice if someone
more experienced could look this over as well. Note that this appears
to have been in the snapshots for a while.
> @@ -420,6 +446,7 @@ expand(char *cp, /* input word */
> if (f&DOBLANK)
> doblank++;
> st = st->prev;
> + word = quote || (!*x.str) ? IFS_WORD :
> IFS_IWS;
This line would need some wrapping. While I'm here: the parens are a bit
strange. Since the precedence here is not completely obvious anyway, I
think they are more confusing than helpful. Why not
word = (quote || !*x.str) ? IFS_WORD :
IFS_IWS;
or even
if (quote || !*x.str)
word = IFS_WORD;
else
word = IFS_IWS;