bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

possible gawk bug


From: mcmahill
Subject: possible gawk bug
Date: Mon, 5 Feb 2001 09:30:51 -0500 (EST)

I'm having a hell of a time with what should be a fairly simple awk
program.  I'm about to conclude there is a bug in gawk.  I've tried nawk
and mawk on various operating systems and those give the result I
expect. 

the bug is in handling of an associative array.  My program reads data
from a file into an array.  Then some processing is done by 
for (toppkg in topdepends){do stuff .... }
but it seems that sometimes elements in the array get missed.

the couple of files you need to reproduce this are at
http://www-mtl.mit.edu/~mcmahill/netbsd/tflat/{tflat,dependstree}

notice that with nawk, the 'find_add_depends(lang/ucblogo)' shows up, but
not with gawk.

address@hidden 146 % nawk -f tflat up dependstree
I have found toppkg="lang/ucblogo" in topdepends
find_all_depends(lang/ucblogo)
I still have toppkg="lang/ucblogo" in topdepends

address@hidden 147 % gawk -f tflat up dependstree
I have found toppkg="lang/ucblogo" in topdepends
I still have toppkg="lang/ucblogo" in topdepends

address@hidden 148 % gawk --version
GNU Awk 3.0.6

address@hidden 149 % uname -a
SunOS bitter.mit.edu 5.6 Generic_105181-17 sun4u sparc SUNW,Ultra-60

address@hidden 150 % /opt/gnu/bin/gawk -f tflat up dependstree
I have found toppkg="lang/ucblogo" in topdepends
I still have toppkg="lang/ucblogo" in topdepends

address@hidden 151 % /opt/gnu/bin/gawk --version
Gnu Awk (gawk) 2.15, patchlevel 6

address@hidden 152 % gcc --version
2.95.1


and now for the real kicker:

address@hidden 154 % sed 's/ucblogo/xcblogo/g' dependstree > newtree

address@hidden 155 % gawk -f tflat up newtree 
I have found toppkg="lang/xcblogo" in topdepends
find_all_depends(lang/xcblogo)
I still have toppkg="lang/xcblogo" in topdepends


so am I just being stupid?  Or did i tickle some bug in gawk?

when I remove the premature 'exit' statement from tflat and run

gawk -f up dependstree | wc -l
gawk -f down dependstree | wc -l

I saw that I'm about 8 lines short in the 'up' version.  Thats what tipped
me off to this.  So that seemed very strange that 99.5% of the output was
there and correct but a few failed.

I also got the same results with various other gawk versions under various
versions of NetBSD on various machines (alpha, sparc, i386).  nawk and
mawk always seem to work and give consistent answers

Thanks much for any help, if there's anything I can do to help, please let
me know.

-Dan











reply via email to

[Prev in Thread] Current Thread [Next in Thread]