On 3/30/17 4:30 AM, Grisha Levit wrote:
> Sorry if you already noticed this: The latest devel push fixes the reported
> field-splitting case but there is a regression with the fields getting
> re-joined with spaces when performing an assignment:
>
>$ set -- 1 2; IFS=; a=$* b=${*/}; printf '<%s>' "$a" "$b"
><12><1 2>
>
> and with the expansion producing fields in the PE assignment case:
>
>$ set -- 1 2; IFS=; unset a b; printf '<%s>' ${a=$*} ${b=${*/}}
><12><1><2>
Thanks for the report. This will be fixed in the next devel branch push.
> Also, upon closer inspection, I suspect the unset IFS case in my report is
> actually an issue with the a=$* case and that b=${*/} behaves correctly
> (aside from not matching the a=$* behavior). The whitespace-trimming-when-
> not-field-splitting thing is something that changed in bash-4.3:
>
>bash-4.2$ unset IFS; set ' '; a=$*; printf '<%s>' "$a"
>< >
>bash-4.3$ unset IFS; set ' '; a=$*; printf '<%s>' "$a"
><>
This, too, but we're getting into more and more corner cases here, as
evidenced by the fact that this hasn't been reported until now.
>
> Also also, the field-splitting issue is also present for arrays subscripted
> with * when undergoing case modification or pattern substitution:
>
>$ A=(1 2); IFS=; printf '<%s>' ${A[*]} ${A[*]/}
><1><2><12>
That's next to look at. I haven't made analogous changes to the array
expansion code yet.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/