busybox-1.15.2 awk broken

Teh Kok How khteh at smartbridges.com
Tue Oct 13 04:35:39 UTC 2009


Hi;
	I have built util-linux's gawk for comparison and the result is the
same. I suspect it has to do with ASH. Which shell did you use in your
testing?

[root at SmartBridges:~ 1]# gawk --version
GNU Awk 3.1.6
Copyright (C) 1989, 1991-2007 Free Software Foundation.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses/.
[root at SmartBridges:~ 1]# gawk -F: '{ print $1 }' /etc/passwd
root:x:0:0:root:/root:/bin/sh
[root at SmartBridges:~ 1]# echo $SHELL
/bin/sh
[root at SmartBridges:~ 1]# echo $TERM
xterm
[root at SmartBridges:~ 1]# awk -F: '{ print $1 }' /etc/passwd
root:x:0:0:root:/root:/bin/sh
[root at SmartBridges:~ 1]# busybox awk -F: '{ print $1 }' /etc/passwd
root:x:0:0:root:/root:/bin/sh
[root at SmartBridges:~ 1]#

Regards,
Teh

-----Original Message-----
From: Denys Vlasenko [mailto:vda.linux at googlemail.com] 
Sent: Monday, October 12, 2009 9:36 PM
To: Teh Kok How
Cc: busybox at busybox.net
Subject: Re: busybox-1.15.2 awk broken

On Mon, Oct 12, 2009 at 12:18 PM, Teh Kok How <khteh at smartbridges.com>
wrote:
> Hi;
>
>             I am using busybox-1.15.2 and simple awk is broken as follows:
>
>
>
> -> awk -F"-" '{ print $1,$2 }' input.txt
>
> intvar[2]: -
>
> intvar[2]: -
>
> Hello-World Hello-World
>
> SmartBridges[0,0]-> cat input.txt
>
> Hello-World
>
> ->
>
>
>
>             The intvar is the printf() that I put in awk.c but apparently,
> the error here is that no matter what field separator I use in the input
> file, the print $1,$2 does not take the correct values from awk.

I don't see any incompatibility with GNU awk:

# cat input.txt
Hello-World
# ./busybox-1.15.2 awk -F"-" '{ print $1,$2 }' input.txt
Hello World
# ./busybox-git awk -F"-" '{ print $1,$2 }' input.txt
Hello World
# awk -F"-" '{ print $1,$2 }' input.txt
Hello World
# awk --version
GNU Awk 3.1.6a
Copyright (C) 1989, 1991-2007 Free Software Foundation.
...

--
vda



More information about the busybox mailing list