Hi All,
Linux : Suse 10.1
$> uname -a
Linux web99 2.6.16.21-0.25-smp #1 SMP Tue Sep 19 07:26:15 UTC 2006 i686 i686
i386 GNU/Linux
$> rpm -qa | grep awk
gawk-3.1.5-18
$> gawk --version | head -n 1
GNU Awk 3.1.5
I came across a problem using a program 'cdb' which uses gawk, it crashes when
used.
After searching, I found another Suse 10.1 user Pablo Costa who had the same
problem. He created the following script to generate the error.
## Start
cd /tmp
# the script; PLEASE take care if you copy on your own file
# to remove the BACKSLASH just before the DOLLAR; It's
# there to prevent the shell from evaluating $i when copy/pasting.
cat > problem.awk <<-EOF
{
print "RECORD " NR;
for ( i = 0; length( \$i ) > 0; i++ ) print " FIELD " i " of " NF;
}
EOF
# It doesn't seem to really matter what kind of input you
# give to the script. Also it doesn't matter if it's given
# on a file via gawk command line invocation or if it's fed
# via stdin through a pipe.
cat > awk_example <<EOF
drwxr-xr-x 2 pablo users 112 2006-06-20 19:29 .
drwxr-xr-x 3 pablo users 248 2006-06-20 19:26 ..
-rw-r--r-- 1 pablo users 0 2006-06-20 19:43 awk_example
-rw-r--r-- 1 pablo users 91 2006-06-20 19:37 problem.awk
drwxr-xr-x 2 pablo users 112 2006-06-20 19:29 .
drwxr-xr-x 3 pablo users 248 2006-06-20 19:26 ..
-rw-r--r-- 1 pablo users 0 2006-06-20 19:43 awk_example
-rw-r--r-- 1 pablo users 91 2006-06-20 19:37 problem.awk
EOF
# Unleash hell!
gawk -f problem.awk awk_example
## End
The result of this script is :
RECORD 1
FIELD 0 of 8
FIELD 1 of 8
FIELD 2 of 8
FIELD 3 of 8
FIELD 4 of 8
FIELD 5 of 8
FIELD 6 of 8
FIELD 7 of 8
FIELD 8 of 8
RECORD 2
FIELD 0 of 8
FIELD 1 of 8
FIELD 2 of 8
*** glibc detected *** gawk: double free or corruption (fasttop): 0x0808b918
***
======= Backtrace: =========
/lib/libc.so.6[0xb7e13911]
/lib/libc.so.6(__libc_free+0x84)[0xb7e14f84]
gawk(str2wstr+0x37)[0x806f2dd]
gawk(do_length+0x1f3)[0x8056c73]
gawk(r_tree_eval+0x3a2)[0x80742f2]
gawk(r_tree_eval+0x75)[0x8073fc5]
gawk[0x8075d12]
gawk(interpret+0x2c6)[0x80727e6]
gawk(interpret+0x221)[0x8072741]
gawk(interpret+0x1b1)[0x80726d1]
gawk(do_input+0x33)[0x806a743]
gawk(main+0x79b)[0x806e33b]
/lib/libc.so.6(__libc_start_main+0xdc)[0xb7dc587c]
gawk[0x804c9b1]
======= Memory map: ========
08048000-08082000 r-xp 00000000 08:02 40243 /bin/gawk
08082000-08083000 rwxp 0003a000 08:02 40243 /bin/gawk
08083000-080a9000 rwxp 08083000 00:00 0 [heap]
b7c00000-b7c21000 rwxp b7c00000 00:00 0
b7c21000-b7d00000 ---p b7c21000 00:00 0
b7d4e000-b7d58000 r-xp 00000000 08:02 30766 /lib/libgcc_s.so.1
b7d58000-b7d59000 rwxp 00009000 08:02 30766 /lib/libgcc_s.so.1
b7d7c000-b7daf000 r-xp 00000000 08:02 30334
/usr/lib/locale/en_GB.utf8/LC_CTYPE
b7daf000-b7db0000 rwxp b7daf000 00:00 0
b7db0000-b7ec9000 r-xp 00000000 08:02 18366 /lib/libc-2.4.so
b7ec9000-b7ecb000 r-xp 00118000 08:02 18366 /lib/libc-2.4.so
b7ecb000-b7ecd000 rwxp 0011a000 08:02 18366 /lib/libc-2.4.so
b7ecd000-b7ed0000 rwxp b7ecd000 00:00 0
b7ed0000-b7ef3000 r-xp 00000000 08:02 18374 /lib/libm-2.4.so
b7ef3000-b7ef5000 rwxp 00022000 08:02 18374 /lib/libm-2.4.so
b7ef5000-b7ef7000 r-xp 00000000 08:02 18372 /lib/libdl-2.4.so
b7ef7000-b7ef9000 rwxp 00001000 08:02 18372 /lib/libdl-2.4.so
b7f14000-b7f15000 rwxp b7f14000 00:00 0
b7f15000-b7f1c000 r-xs 00000000 08:02 251728
/usr/lib/gconv/gconv-modules.cache
b7f1c000-b7f1d000 rwxp b7f1c000 00:00 0
b7f1d000-b7f37000 r-xp 00000000 08:02 18359 /lib/ld-2.4.so
b7f37000-b7f39000 rwxp 00019000 08:02 18359 /lib/ld-2.4.so
bfd19000-bfd2f000 rw-p bfd19000 00:00 0 [stack]
ffffe000-fffff000 ---p 00000000 00:00 0 [vdso]
Aborted
The result on another Fedora box :
RECORD 1
FIELD 0 of 8
FIELD 1 of 8
FIELD 2 of 8
FIELD 3 of 8
FIELD 4 of 8
FIELD 5 of 8
FIELD 6 of 8
FIELD 7 of 8
FIELD 8 of 8
RECORD 2
FIELD 0 of 8
FIELD 1 of 8
FIELD 2 of 8
FIELD 3 of 8
FIELD 4 of 8
FIELD 5 of 8
FIELD 6 of 8
FIELD 7 of 8
FIELD 8 of 8
RECORD 3
FIELD 0 of 8
FIELD 1 of 8
FIELD 2 of 8
FIELD 3 of 8
FIELD 4 of 8
FIELD 5 of 8
FIELD 6 of 8
FIELD 7 of 8
FIELD 8 of 8
RECORD 4
FIELD 0 of 8
FIELD 1 of 8
FIELD 2 of 8
FIELD 3 of 8
FIELD 4 of 8
FIELD 5 of 8
FIELD 6 of 8
FIELD 7 of 8
FIELD 8 of 8
RECORD 5
FIELD 0 of 8
FIELD 1 of 8
FIELD 2 of 8
FIELD 3 of 8
FIELD 4 of 8
FIELD 5 of 8
FIELD 6 of 8
FIELD 7 of 8
FIELD 8 of 8
RECORD 6
FIELD 0 of 8
FIELD 1 of 8
FIELD 2 of 8
FIELD 3 of 8
FIELD 4 of 8
FIELD 5 of 8
FIELD 6 of 8
FIELD 7 of 8
FIELD 8 of 8
RECORD 7
FIELD 0 of 8
FIELD 1 of 8
FIELD 2 of 8
FIELD 3 of 8
FIELD 4 of 8
FIELD 5 of 8
FIELD 6 of 8
FIELD 7 of 8
FIELD 8 of 8
RECORD 8
FIELD 0 of 8
FIELD 1 of 8
FIELD 2 of 8
FIELD 3 of 8
FIELD 4 of 8
FIELD 5 of 8
FIELD 6 of 8
FIELD 7 of 8
FIELD 8 of 8
______________________________________________________
Q u a d L o g i c - Solutions Internet
Tel: +33 1 4037 0040 - Fax: +33 1 4035 3194
18 pl de la Chapelle, 75018 Paris, France
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]