World splitting is correct; demonstration by the reporter is wrong.

The read command yields the expected array. When the array a is
substituted, the command

printf -- '-%s-\n' ${a[*]}

is interpreted as

printf -- '-%s-\n' a b c d

which produces the reported output indeed. On the other hand, the
following command, with "${a[@]}" instead of ${a[*]} produces the
expected output:

printf 'a b/c\nd\0' | while IFS=/ read -d $'\0' -r -a a; do printf --
'-%s-\n' "${a[@]}"; done

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1617572

Title:
  Field splitting is not done correctly

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/bash/+bug/1617572/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to