On 20/06/2017 06:33, Eduardo A. Bustamante López wrote:
> On Tue, Jun 20, 2017 at 01:13:07AM +0100, Kevin Brodsky wrote:
> [...]
>> When IFS is unset, unquoted $* undergoes word splitting as if IFS=' ',
>> and not the expected IFS=$' \t\n'. All the other unquoted mass
>> This is a regression that appeared in 4.3 and is still present on devel
> [...]
>
> AFAICT, the following patch fixes this.
>
> diff --git a/subst.c b/subst.c
> index 3093309f..bf73a35f 100644
> --- a/subst.c
> +++ b/subst.c
> @@ -10158,7 +10158,7 @@ finished_with_string:
>        or we expanded "$@" with IFS null and we need to split the positional
>        parameters into separate words. */
>        if (split_on_spaces)
> -     list = list_string (istring, " ", 1);   /* XXX quoted == 1? */
> +     list = list_string (istring, " \t\n", 1);       /* XXX quoted == 1? */
>        /* If we have $@ (has_dollar_at != 0) and we are in a context where we
>        don't want to split the result (W_NOSPLIT2), and we are not quoted,
>        we have already separated the arguments with the first character of
>
> The above code (`list_string' function call when split_on_spaces != 0)
> seems to be executed when IFS is either unset or the empty string. The
> comment above that block of code mentions that in either case, the
> result should be "split on spaces", although it has a narrow definition
> of space.
>

The comments about "IFS either unset or null" confuse me, because word
splitting should behave very differently when IFS is null (there is no
word splitting at all, whereas unset IFS is equivalent to IFS=$' \t\n').
My tests show that the behaviour is as expected when IFS is null, so I'm
wondering if the comments match the actual behaviour.

Kevin

Reply via email to