|
Packit Service |
f629e6 |
#From dhw@gamgee.acad.emich.edu Sat Oct 31 22:54:07 1998
|
|
Packit Service |
f629e6 |
#Return-Path: <dhw@gamgee.acad.emich.edu>
|
|
Packit Service |
f629e6 |
#Received: from cssun.mathcs.emory.edu (cssun.mathcs.emory.edu [170.140.150.1])
|
|
Packit Service |
f629e6 |
# by amx.netvision.net.il (8.9.0.Beta5/8.8.6) with ESMTP id HAA08891
|
|
Packit Service |
f629e6 |
# for <arobbins@netvision.net.il>; Sat, 31 Oct 1998 07:14:07 +0200 (IST)
|
|
Packit Service |
f629e6 |
#Received: from mescaline.gnu.org (we-refuse-to-spy-on-our-users@mescaline.gnu.org [158.121.106.21]) by cssun.mathcs.emory.edu (8.7.5/8.6.9-940818.01cssun) with ESMTP id AAA14947 for <arnold@mathcs.emory.edu>; Sat, 31 Oct 1998 00:14:32 -0500 (EST)
|
|
Packit Service |
f629e6 |
#Received: from gamgee.acad.emich.edu (gamgee.acad.emich.edu [164.76.102.76])
|
|
Packit Service |
f629e6 |
# by mescaline.gnu.org (8.9.1a/8.9.1) with SMTP id AAA20645
|
|
Packit Service |
f629e6 |
# for <arnold@gnu.ai.mit.edu>; Sat, 31 Oct 1998 00:17:54 -0500
|
|
Packit Service |
f629e6 |
#Received: by gamgee.acad.emich.edu (Smail3.1.29.1 #57)
|
|
Packit Service |
f629e6 |
# id m0zZUKY-000IDSC; Sat, 31 Oct 98 00:16 CST
|
|
Packit Service |
f629e6 |
#Message-Id: <m0zZUKY-000IDSC@gamgee.acad.emich.edu>
|
|
Packit Service |
f629e6 |
#Date: Sat, 31 Oct 98 00:16 CST
|
|
Packit Service |
f629e6 |
#From: dhw@gamgee.acad.emich.edu (David H. West)
|
|
Packit Service |
f629e6 |
#To: bug-gnu-utils@gnu.org
|
|
Packit Service |
f629e6 |
#Subject: gawk 3.0.3 bug report
|
|
Packit Service |
f629e6 |
#Cc: arnold@gnu.org
|
|
Packit Service |
f629e6 |
#X-UIDL: 7474b825cff989adf38f13883d84fdd7
|
|
Packit Service |
f629e6 |
#Status: RO
|
|
Packit Service |
f629e6 |
#
|
|
Packit Service |
f629e6 |
#gawk version: 3.03
|
|
Packit Service |
f629e6 |
#System used: Linux, kernel 2.0.28, libc 5.4.33, AMD K5PR133 (i586 clone)
|
|
Packit Service |
f629e6 |
#Remark: There seems to be at least one bug shown by the demo below.
|
|
Packit Service |
f629e6 |
# There may also be a Dark Corner involving the value of NR in an
|
|
Packit Service |
f629e6 |
# END block, a topic on which the info file is silent. In gawk
|
|
Packit Service |
f629e6 |
# 3.0.3, NR often seems to have the least-surprise value in an
|
|
Packit Service |
f629e6 |
# END block, but sometimes it doesn't - see example below.
|
|
Packit Service |
f629e6 |
#Problem descr: the log below shows a case where:
|
|
Packit Service |
f629e6 |
# a) (this may be a red herring) the output of the gawk script
|
|
Packit Service |
f629e6 |
# is different depending on whether its input file is named on
|
|
Packit Service |
f629e6 |
# the command line or catted to stdin, without any use of the
|
|
Packit Service |
f629e6 |
# legitimate means which could produce this effect.
|
|
Packit Service |
f629e6 |
# b) NR is clearly getting clobbered; I have tried to simplify
|
|
Packit Service |
f629e6 |
# the 19-line script "awkerr1" below, but seemingly unrelated
|
|
Packit Service |
f629e6 |
# changes, like shortening constant strings which appear only in
|
|
Packit Service |
f629e6 |
# print statements, or removing unexecuted or irrelevant code,
|
|
Packit Service |
f629e6 |
# cause the clobbering to go away. Some previous (larger)
|
|
Packit Service |
f629e6 |
# versions of this code would clobber NR also when reading from
|
|
Packit Service |
f629e6 |
# stdin, but I thought you'd prefer a shorter example :-).
|
|
Packit Service |
f629e6 |
#Reproduce-By: using the gawk script "awkerr1", the contents of
|
|
Packit Service |
f629e6 |
# which appear in the transcript below as the output of the
|
|
Packit Service |
f629e6 |
# command "cat awkerr1". Comments following # were added
|
|
Packit Service |
f629e6 |
# to the transcript later as explanation.
|
|
Packit Service |
f629e6 |
#---------------------------------------------- Script started on Fri
|
|
Packit Service |
f629e6 |
#Oct 30 20:04:16 1998 chipmunk:/ram0# ls -l a1 awkerr1 -rw-r--r-- 1
|
|
Packit Service |
f629e6 |
#root root 2 Oct 30 18:42 a1 -rwxr-xr-x 1 root root
|
|
Packit Service |
f629e6 |
#389 Oct 30 19:54 awkerr1 chipmunk:/ram0# cat a1 #a1 contains
|
|
Packit Service |
f629e6 |
#one printable char and a newline a chipmunk:/ram0# od -c? ?xc a1
|
|
Packit Service |
f629e6 |
#0000000 0a61
|
|
Packit Service |
f629e6 |
# a \n
|
|
Packit Service |
f629e6 |
#0000002 chipmunk:/ram0# cat a1 | awkerr1 #no surprises here
|
|
Packit Service |
f629e6 |
#1 lines in 1 sec: 1 lines/sec; nlines=1 chipmunk:/ram0# awkerr1 a1 È
|
|
Packit Service |
f629e6 |
#lines in 1 sec: 1 lines/sec; nlines=1 #?! first char is an uppercase
|
|
Packit Service |
f629e6 |
#E-grave chipmunk:/ram0# awkerr1 a1 | od -N1 -xc 0000000 00c8
|
|
Packit Service |
f629e6 |
# 310 \0
|
|
Packit Service |
f629e6 |
#0000001 chipmunk:/ram0# cat awkerr1 #the apparent ^M's are not
|
|
Packit Service |
f629e6 |
#actually in the file
|
|
Packit Service |
f629e6 |
#!/usr/bin/awk -f
|
|
Packit Service |
f629e6 |
function process(w) {
|
|
Packit Service |
f629e6 |
if(w in ws) {
|
|
Packit Service |
f629e6 |
printf " : found\n"; lc[p " " w]++; rc[w " " n]++; }
|
|
Packit Service |
f629e6 |
}
|
|
Packit Service |
f629e6 |
BEGIN {IGNORECASE=1;
|
|
Packit Service |
f629e6 |
}
|
|
Packit Service |
f629e6 |
/^/ {if(NR % 10 ==0)print "processing line " NR;
|
|
Packit Service |
f629e6 |
process($1); nlines++;
|
|
Packit Service |
f629e6 |
}
|
|
Packit Service |
f629e6 |
END {p=w; w=n; n="";
|
|
Packit Service |
f629e6 |
if(w)process(w); t=1; print NR " lines in " t " sec: " NR+0 " lines/sec; nlines=" nlines;
|
|
Packit Service |
f629e6 |
}
|
|
Packit Service |
f629e6 |
#chipmunk:/ram0# exit Script done on Fri Oct 30 20:07:31 1998
|
|
Packit Service |
f629e6 |
#---------------------------------------------
|
|
Packit Service |
f629e6 |
#
|
|
Packit Service |
f629e6 |
#-David West dhw@gamgee.acad.emich.edu
|
|
Packit Service |
f629e6 |
#
|