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

2017-06-24 Thread Chet Ramey
On 6/23/17 10:35 PM, Robert Elz wrote: > Date:Fri, 23 Jun 2017 11:39:45 -0400 > From:Greg Wooledge > Message-ID: <20170623153945.ga4...@eeg.ccf.org> > > | That's what I always thought too, but if commonly used shells like > | dash can't even agree on this, then I

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

2017-06-24 Thread Eduardo A . Bustamante López
On Sat, Jun 24, 2017 at 09:10:34PM +0700, Robert Elz wrote: [...] > The bugs in various implementations cause problems, yes, dealing with > someone else's mistakes (and especially doing it in a way that things > still work when the bugs get fixed) can be difficult. > > But the rules, no, the rules

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

2017-06-24 Thread Robert Elz
Date:Sat, 24 Jun 2017 07:59:25 -0500 From:Eduardo =?utf-8?Q?A=2E_Bustamante_L=C3=B3pez?= Message-ID: <20170624125925.7vnb4kk35gh3obbk@debian> | I think we can all agree that the rules (and bugs) around | the expansion of $* are too complex. The bugs in various i

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

2017-06-24 Thread Eduardo A . Bustamante López
On Sat, Jun 24, 2017 at 09:35:34AM +0700, Robert Elz wrote: [...] > In cases where IFS is not a null string, the broken implementations mostly > tend to work OK (sometimes perhaps only by a fluke), and even more work > properly if IFS has its default value or something similar, that is > where IFS[

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

2017-06-23 Thread Robert Elz
Date:Fri, 23 Jun 2017 11:39:45 -0400 From:Greg Wooledge Message-ID: <20170623153945.ga4...@eeg.ccf.org> | That's what I always thought too, but if commonly used shells like | dash can't even agree on this, then I simply upgrade my response level | from "bad prac

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

2017-06-23 Thread Chet Ramey
On 6/23/17 11:27 AM, Robert Elz wrote: > Date:Thu, 22 Jun 2017 07:51:12 -0400 > From:Greg Wooledge > Message-ID: <20170622115111.gq22...@eeg.ccf.org> > > > | $ dash > | $ set -- a b > | $ IFS= > | $ args $* > | 1 args: > > That is simply broken. Always h

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

2017-06-23 Thread Greg Wooledge
On Fri, Jun 23, 2017 at 10:27:44PM +0700, Robert Elz wrote: > $* is just $1 $2 ... (for as many params as set) as separate words. That's what I always thought too, but if commonly used shells like dash can't even agree on this, then I simply upgrade my response level from "bad practice" to "comple

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

2017-06-23 Thread Robert Elz
Date:Thu, 22 Jun 2017 07:51:12 -0400 From:Greg Wooledge Message-ID: <20170622115111.gq22...@eeg.ccf.org> | $ dash | $ set -- a b | $ IFS= | $ args $* | 1 args: That is simply broken. Always has been, whatever mistakes were in the wording posix used to us

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

2017-06-22 Thread DJ Mills
On Thu, Jun 22, 2017 at 7:51 AM, Greg Wooledge wrote: > On Wed, Jun 21, 2017 at 10:30:22PM -0400, Chet Ramey wrote: > > OK, going forward, I am officially considering any use of unquoted $* > or $@ in a script to be a BUG, an invocation of undefined behavior, > not acceptable, no excuses. > > I t

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

2017-06-22 Thread Greg Wooledge
On Wed, Jun 21, 2017 at 10:30:22PM -0400, Chet Ramey wrote: > However, not all shells were consistent in their interpretation of the > Posix rules. For instance, dash, which bills itself as being completely > Posix conformant, produces 1 for that case (and expands to "ab"). The > Bourne shell (SVR

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

2017-06-21 Thread Chet Ramey
On 6/21/17 6:01 PM, Kevin Brodsky wrote: > On 21/06/2017 20:29, Chet Ramey wrote: >> On 6/21/17 2:43 PM, Kevin Brodsky wrote: >> >>> That is also my reading of POSIX (and that's more or less what Bash's >>> manpage says as well), but it doesn't seem to be the case (even in <=4.2): >> That's a relat

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

2017-06-21 Thread Kevin Brodsky
On 21/06/2017 20:29, Chet Ramey wrote: > On 6/21/17 2:43 PM, Kevin Brodsky wrote: > >> That is also my reading of POSIX (and that's more or less what Bash's >> manpage says as well), but it doesn't seem to be the case (even in <=4.2): > That's a relatively new requirement. The portion of the relev

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

2017-06-21 Thread Chet Ramey
On 6/21/17 2:43 PM, Kevin Brodsky wrote: > That is also my reading of POSIX (and that's more or less what Bash's > manpage says as well), but it doesn't seem to be the case (even in <=4.2): That's a relatively new requirement. The portion of the relevant sentence that reads "initially producing

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

2017-06-21 Thread Kevin Brodsky
On 21/06/2017 14:54, Chet Ramey wrote: > On 6/20/17 1:33 AM, 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

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

2017-06-21 Thread Chet Ramey
On 6/20/17 1:33 AM, 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 ap

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

2017-06-21 Thread Chet Ramey
On 6/19/17 8:13 PM, Kevin Brodsky wrote: > Hi, > > When IFS is unset, unquoted $* undergoes word splitting as if IFS=' ', > and not the expected IFS=$' \t\n'. All the other unquoted mass > expansions ($@, array[*], array[@]) are word-split as if IFS=$' > \t\n'. Thanks for the report. This will be

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

2017-06-20 Thread Kevin Brodsky
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 a

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

2017-06-19 Thread Eduardo A . Bustamante López
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

Unexpected word splitting on $* when IFS is unset

2017-06-19 Thread Kevin Brodsky
Hi, When IFS is unset, unquoted $* undergoes word splitting as if IFS=' ', and not the expected IFS=$' \t\n'. All the other unquoted mass expansions ($@, array[*], array[@]) are word-split as if IFS=$' \t\n'.For instance: nb_args() { echo $#; } set -- $'a\nb' unset IFS # Expected: 2,