[Bug 5108] New: awk uses updated FS too early
bugzilla at busybox.net
bugzilla at busybox.net
Mon Apr 16 20:24:08 UTC 2012
https://bugs.busybox.net/show_bug.cgi?id=5108
Summary: awk uses updated FS too early
Product: Busybox
Version: 1.19.x
Platform: PC
OS/Version: Linux
Status: NEW
Severity: minor
Priority: P5
Component: Standard Compliance
AssignedTo: unassigned at busybox.net
ReportedBy: dubiousjim at gmail.com
CC: busybox-cvs at busybox.net
Estimated Hours: 0.0
BusyBox 1.19.3, built against uClibc 0.9.32, on i686 Linux
The POSIX-2008 standard says that changing FS should have no effect on the
current input line, but only on the next one. The language is:
> Before the first reference to a field in the record is evaluated, the record
> shall be split into fields, according to the rules in Regular Expressions,
> using the value of FS that was current at the time the record was read.
(Supposedly, this requirement was introduced as far back as 1996.) BusyBox awk
doesn't conform to this requirement: if no fields have yet been referenced, the
new value of FS will be used also for parsing the current line.
For example. POSIX requires that this:
$ printf 'a:b c:d\ne:f g:h' | awk '{FS=":"; print $1}'
should print:
a:b
e
and that is indeed the behavior of gawk. But BusyBox awk prints:
a
e
--
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