[Search for users]
[Overall Top Noters]
[List of all Conferences]
[Download this site]
Title: | DIGITAL UNIX (FORMERLY KNOWN AS DEC OSF/1) |
Notice: | Welcome to the Digital UNIX Conference |
Moderator: | SMURF::DENHAM |
|
Created: | Thu Mar 16 1995 |
Last Modified: | Fri Jun 06 1997 |
Last Successful Update: | Fri Jun 06 1997 |
Number of topics: | 10068 |
Total number of notes: | 35879 |
Hi
I have a customer who has written an awk script. This script runs ok under
gawk and aix awk but under nawk/awk it drops a huge core file and gives a
1104 Memory fault message at the end. The problem occures under 3.2x and 4.0x
of Digital Unix.
Checking the core file shows nawk bombing at regcomp.
The awk script is below but the data files are at
http://www.stl.dec.com/~adrian/Q52975
Can anyone see an obvious problem with this script before I impt this?
Thanks kindly
Adrian Morrisson
[ -s list ] || { echo "No list file ?!!?" ; exit 2 ; }
[ -s ./db.excluded ] || { echo "No db.excluded file ?!!?" ; exit 2 ; }
nawk 'BEGIN { states = "seek"
lg = "pickup.log"
mf = "db.new_misc"
xf = "db.remain"
objcnt = 0 ; cnta = 0
i = 0 ; ac = 0 ; j = 0
list = ARGV[1] ; delete ARGV[1]
while ( getline < list > 0 ) lst[$1] = ++i
print "Loaded " i " relevant table names !\n" > lg
close(list)
}
$0 ~ /^[ ]*--/ { next }
NF == 0 { next }
$0 ~ /^\{ TABLE / { next }
states == "found" { print $0 > mf
if ( $0 ~ /;/ ) states = "seek"
next }
states == "doco" { if ( $0 ~ /;/ ) states = "seek"
next }
{ for ( i in lst ) {
match ($0, i)
if ( RLENGTH > 0 ) {
if ( substr($0, ((RSTART-1)), 1) ~ /[_0-9a-zA-Z]/ ||
substr($0, ((RSTART+RLENGTH)), 1) ~ /[_0-9a-zA-Z]/ ) {
continue
}
states = "found"
objcnt++
print "Discovered _____ " i > lg
print "Processing _____ \n" $0
break
}
} # for...
if ( states == "found" ) {
for ( j=1; j<=ac; j++ ) {
print arr[j] > mf
delete arr[j] }
ac = 0
print $0 > mf
if ( $0 ~ /;/ ) states = "seek"
}
else {
if ( $0 ~ /;/ ) {
for ( j=1; j<=ac; j++ ) {
print arr[j] > xf
delete arr[j] }
ac = 0
print $0 > xf
}
else arr[++ac] = $0
}
} # section...
ac > 100 { print "(" NR "): statement line counter over 100 !" >
"xx.out" }
{ next }
$0 ~ /^[ ]*grant / { n = split ( $3, aa, "." )
tbl = aa[n]
if ( tbl in lst ) {
print $2 "(" tbl ")"
print "Processed _____ " tbl > lg
viewcnt++
print $0 > cf
print "drop " $2 " " $3 " ;" > df
states = "view"
}
else { print "Skipped >>>>>>>" $3 > lg
print $0 > xf
states = "skip" }
if ( $0 ~ /;/ ) states = "seek"
next
}
END { print "\nCounted " objcnt " discoveries of listed names." > lg
print "GRANT SQL redone = " cnta > lg
}' \
list ./db.excluded
Stack Trace~
~_regcomp_C(0x12000ae70, 0x140045a40, 0x140045a80, 0x14000a738, 0x14)
[0x3ff800ee79c]
__regcomp(0x140045a80, 0x14000a738, 0x14, 0x14001db70, 0x12000ae8c)
[0x3ff800e426c]
(dbx)
[Posted by WWW Notes gateway]
T.R | Title | User | Personal Name | Date | Lines |
---|
9865.1 | use gawk with arrays | USCTR1::REICH | | Mon May 19 1997 15:50 | 11 |
| Your customer's awk program creates an array called "lst" from records in
a file called "list". I have noticed using Digital UNIX awk/nawk, that
these array variables will not always be in the same sequence as in the
file from which they came. If maintaining the sequence is important, then
you must use gawk. This problem is mentioned in Dale Dougherty's book "sed
& awk". He describes it as a known problem in awk, and one that is
"implementation dependent" in nawk.
Also, the customer uses the "lst" array and the match function in the same
code block. In the Dale Dougherty book, it seems odd that the two match function
programming examples in the chapter on nawk are actually presented using gawk.
|