bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unexpected word splitting on $* when IFS is unset


From: Eduardo A . Bustamante López
Subject: Re: Unexpected word splitting on $* when IFS is unset
Date: Tue, 20 Jun 2017 00:33:08 -0500
User-agent: NeoMutt/20170113 (1.7.2)

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.

-- 
Eduardo Bustamante
https://dualbus.me/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]