Bug 7226

Summary: awk parsing bug
Product: Busybox Reporter: Charlie <charles.fisher>
Component: OtherAssignee: unassigned
Status: RESOLVED FIXED    
Severity: minor CC: busybox-cvs, charles.fisher
Priority: P5    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Host: Target:
Build:

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