Bug 7226 - awk parsing bug
Summary: awk parsing bug
Status: RESOLVED FIXED
Alias: None
Product: Busybox
Classification: Unclassified
Component: Other (show other bugs)
Version: unspecified
Hardware: PC Linux
: P5 minor
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-24 15:17 UTC by Charlie
Modified: 2014-06-26 14:42 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Charlie 2014-06-24 15:17:13 UTC
The following runs successfully with gawk:

     BEGIN { print "Enter some stuff, stop with . (dot):\n"

     while(getline) if($1 == "." && NF == 1) break; else list[i++] = $0

     for(j=0; j<i; j++) print list[j] }

It fails in busybox with:

     $ /sbin/busybox awk -f testcase.awk
     awk: testcase.awk:3: Unexpected token

If I adjust the script to the following, it will run properly:

     BEGIN { print "Enter some stuff, stop with . (dot):\n"

     while(getline) if($1 == "." && NF == 1)
             { break }
     else list[i++] = $0

     for(j=0; j<i; j++) print list[j] }

I have found this behavior on Oracle Linux 5.10 Busybox version 1.2.0, and Mingw-Win32 Busybox version v1.23.0-TIG-1525-ge19594c