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
Touch seeded packages, which is subscribed to bash in Ubuntu.
https://bugs.launchpad.net/bugs/1617572

Title:
  Field splitting is not done correctly

Status in bash package in Ubuntu:
  New

Bug description:
  $ printf 'a b/c\nd\0' | while IFS=/ read -d $'\0' -r -a a; do printf -- 
'-%s-\n' ${a[*]}; done
  -a-
  -b-
  -c-
  -d-
  When expected output is:
  -a b-
  -c
  d-

  ProblemType: Bug
  DistroRelease: Ubuntu 16.04
  Package: bash 4.3-14ubuntu1.1
  ProcVersionSignature: Ubuntu 4.4.0-31.50-generic 4.4.13
  Uname: Linux 4.4.0-31-generic x86_64
  NonfreeKernelModules: nvidia_uvm nvidia
  ApportVersion: 2.20.1-0ubuntu2.1
  Architecture: amd64
  CurrentDesktop: XFCE
  Date: Sat Aug 27 16:38:11 2016
  EcryptfsInUse: Yes
  InstallationDate: Installed on 2015-11-21 (279 days ago)
  InstallationMedia: Xubuntu 15.10 "Wily Werewolf" - Release amd64 (20151021)
  SourcePackage: bash
  UpgradeStatus: Upgraded to xenial on 2016-06-24 (63 days ago)

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

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to