View Single Post
  #1   (View Single Post)  
Old 20th January 2010
s0xxx's Avatar
s0xxx s0xxx is offline
Package Pilot
Join Date: May 2008
Posts: 192
Default All awk's on Solaris are broken!

Here is an interesting message from comp.lang.awk list that explains why all awk's that come with Solaris are "no good".
Actually *ALL* awk implementations shipped with Solaris are broken :-/

0 cheusov>/usr/xpg4/bin/awk '$0 ~ /=/'
/usr/xpg4/bin/awk: syntax error Context is:
>>> $0 ~ /= <<<

1 cheusov>/usr/bin/nawk '$0 ~ /=/'
/usr/bin/nawk: syntax error at source line 1
context is
$0 ~ >>> /= <<<
/usr/bin/nawk: bailing out at source line 1

2 cheusov>/usr/bin/awk '$0 ~ /=/'
awk: syntax error near line 1
awk: bailing out near line 1

2 cheusov>uname -a
SunOS solaris 5.10 Generic_125100-08 sun4u sparc SUNW,Ultra-5_10

0 cheusov>

This is just one bug, there are others.

"The One True AWK" by Brian Kernigan has also lots of problems.
Lots of them were sucessfully fixed in NetBSD.

- fixed: serious bug with regular expression, PR/33392
- fixed: support for multibyte charsets in tolower/toupper functions,
- fixed: there is a hardcoded limit on a number of open files, PR/37205
- fixed: incorrect handling of \ at the end of line in awk script, PR/37212
- fixed: incorrect matching of [:cntrl:], PR/38737
- fixed: warning about non-portable escape sequences, PR/39002
- fixed: free(): warning: junk pointer, too low to make sense, PR/39132
- fixed: -Ft is broken, PR/39133
- fixed: segfaults when "nextfile" is in BEGIN {...}, bin/39134
- fixed: nawk doesn't handle RS as a RE but as a single character, PR/30294
- fixed: awk(1) crash with RE and ^ anchor, PR/40689

Others are not fixed:
- Bizarre behavior in awk with invalid numeric constants, PR/42463
- LC_NUMERIC in awk is not POSIX compliant, PR/42320
- NetBSD awk/nawk concatenation op. is slower than that of GNU awk, PR/39759
- /usr/bin/awk: formatting issues in printf, PR/39135
- regexps should treat { and } as {n,m}, but as regular
characters, PR/38127

I sent all this to Brian, but he ignored all these issues and fixes.

Author of message is Aleksey Cheusov, creator of RUNAWK wrapper utility for awk.

Warning for all using awk on Solaris!
The best way to learn UNIX is to play with it, and the harder you play, the more you learn.
If you play hard enough, you'll break something for sure, and having to fix a badly broken system is arguably the fastest way of all to learn. -Michael Lucas, AbsoluteBSD
Reply With Quote