[Bug 235] New: ash: incorrect word splitting with read builtin
bugzilla at busybox.net
bugzilla at busybox.net
Mon Mar 30 17:31:17 UTC 2009
https://bugs.busybox.net/show_bug.cgi?id=235
Summary: ash: incorrect word splitting with read builtin
Product: Busybox
Version: 1.13.x
Platform: PC
OS/Version: Linux
Status: NEW
Severity: enhancement
Priority: P5
Component: Standard Compliance
AssignedTo: unassigned at busybox.net
ReportedBy: truedfx at gentoo.org
CC: busybox-cvs at busybox.net
Estimated Hours: 0.0
The read builtin in ash performs word splitting differently depending on
whether the first character in $IFS is a space.
printf 'a\t\tb\tc\n' | busybox ash -c 'IFS=$(printf "\t") read a b c; echo
".$a. .$b. .$c."'
.a. .. .b c.
printf 'a\t\tb\tc\n' | busybox ash -c 'IFS=$(printf " \t") read a b c; echo
".$a. .$b. .$c."'
.a. .b. .c.
printf 'a,,b,c\n' | busybox ash -c 'IFS="," read a b c; echo ".$a. .$b. .$c."'
.a. .. .b,c.
printf 'a,,b,c\n' | busybox ash -c 'IFS=" ," read a b c; echo ".$a. .$b. .$c."'
.a. .b. .c.
This isn't right. Whether multiple characters form a single field separator
depends on whether those characters themselves are whitespace characters, not
on whether space is present in $IFS. Current behaviour is different from how
IFS is handled during ordinary word splitting, different from what susv3
specifies, and different from other shells, so I'm going to assume this is
unintentional.
For reference, here's bash's behaviour:
printf 'a\t\tb\tc\n' | bash -c 'IFS=$(printf "\t") read a b c; echo ".$a. .$b.
.$c."'
.a. .b. .c.
printf 'a\t\tb\tc\n' | bash -c 'IFS=$(printf " \t") read a b c; echo ".$a. .$b.
.$c."'
.a. .b. .c.
printf 'a,,b,c\n' | bash -c 'IFS="," read a b c; echo ".$a. .$b. .$c."'
.a. .. .b,c.
printf 'a,,b,c\n' | bash -c 'IFS=" ," read a b c; echo ".$a. .$b. .$c."'
.a. .. .b,c.
--
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the busybox-cvs
mailing list