Subject: bin/34067: awk dumps core when doing `make readme' in /usr/pkgsrc
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: None <johan.wallen+gnats@tkk.fi>
List: netbsd-bugs
Date: 07/24/2006 07:00:00
>Number:         34067
>Category:       bin
>Synopsis:       awk dumps core when doing `make readme' in /usr/pkgsrc
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jul 24 07:00:00 +0000 2006
>Originator:     Johan Wallen
>Release:        NetBSD 3.99.22 20060717
>Organization:
Helsinki University of Technology
	
>Environment:
	
	
System: NetBSD enigma.tcs.hut.fi 3.99.22 NetBSD 3.99.22 (GENERIC) #2: Mon Jul 17 22:52:48 EEST 2006 johan@enigma.tcs.hut.fi:/usr/obj/macppc/sys/arch/macppc/compile/GENERIC macppc
Architecture: powerpc
Machine: macppc
pkgsrc from 20060717 (HEAD) 
>Description:
When doing `make readme' in /usr/pkgsrc, the following happens (redundant
lines removed):

[...]
Generating package README.html files
 
Reading database file
Making sure binary package cache file is up to date...
----> Checking master cache file /usr/pkgsrc/packages/.pkgcache
      Master cache file /usr/pkgsrc/packages/.pkgcache is up to date
Loading binary package cache file...
    * /usr/pkgsrc/packages/.pkgcache
Flattening dependencies
awk in free(): warning: junk pointer, too high to make sense.  [48 times]
awk in free(): warning: chunk is already free.
awk in free(): warning: junk pointer, too high to make sense.
awk in free(): warning: junk pointer, too high to make sense.
awk in free(): warning: chunk is already free.
awk in free(): warning: junk pointer, too high to make sense.  [21 times]
awk in free(): warning: page is already free.
awk in free(): warning: page is already free.
awk in free(): warning: junk pointer, too high to make sense.  [314 times]
[1]   Segmentation fault (core dumped) ${AWK} -f ${PKGS...
Error:  genreadme.awk failed to create README.html files
*** Error code 1

gdb backtrace (COPTS+= -g added to src/usr.bin/awk/Makefile) follows:

GNU gdb 6.5
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "powerpc--netbsd"...
Reading symbols from /usr/lib/libm.so.0...done.
Loaded symbols for /usr/lib/libm.so.0
Reading symbols from /usr/lib/libc.so.12...done.
Loaded symbols for /usr/lib/libc.so.12
Reading symbols from /usr/libexec/ld.elf_so...done.
Loaded symbols for /usr/libexec/ld.elf_so
Core was generated by `awk'.
Program terminated with signal 11, Segmentation fault.
#0  0xeff6a3c0 in tcgetattr () from /usr/lib/libc.so.12
(gdb) bt
#0  0xeff6a3c0 in tcgetattr () from /usr/lib/libc.so.12
#1  0xeff6b0d0 in free () from /usr/lib/libc.so.12
#2  0x0180332c in freefa (f=0x20e8c00) at /usr/src/dist/nawk/b.c:946
#3  0x018058f0 in makedfa (s=0x2693000 "", anchor=14772)
    at /usr/src/dist/nawk/b.c:154
#4  0x018100ec in matchop (a=<value optimized out>, n=266)
    at /usr/src/dist/nawk/run.c:589
#5  0x0180ba64 in execute (u=<value optimized out>)
    at /usr/src/dist/nawk/run.c:156
#6  0x0180fda4 in relop (a=0x19edbd0, n=12) at /usr/src/dist/nawk/run.c:649
#7  0x0180ba64 in execute (u=<value optimized out>)
    at /usr/src/dist/nawk/run.c:156
#8  0x0180dd14 in ifstat (a=0x19edd10, n=12) at /usr/src/dist/nawk/run.c:1358
#9  0x0180ba64 in execute (u=<value optimized out>)
    at /usr/src/dist/nawk/run.c:156
#10 0x0180dc5c in whilestat (a=0x19edd70, n=<value optimized out>)
    at /usr/src/dist/nawk/run.c:1378
#11 0x0180ba64 in execute (u=<value optimized out>)
    at /usr/src/dist/nawk/run.c:156
#12 0x018111f0 in cal#15 0x0180ba64 in execute (u=<value optimized out>)
    at /usr/src/dist/nawk/run.c:156
#13 0x0180ba64 in execute (u=<value optimized out>)
    at /usr/src/dist/nawk/run.c:156
#14 0x0180e7d4 in assign (a=0x19cb650, n=12) at /usr/src/dist/nawk/run.c:1085
#15 0x0180ba64 in execute (u=<value optimized out>)
    at /usr/src/dist/nawk/run.c:156
#16 0x018111f0 in call (a=<value optimized out>, n=<value optimized out>)
    at /usr/src/dist/nawk/run.c:280
#17 0x0180ba64 in execute (u=<value optimized out>)
    at /usr/src/dist/nawk/run.c:156
#18 0x0180d98c in instat (a=0x26de8e0, n=<value optimized out>)
    at /usr/src/dist/nawk/run.c:1447
#19 0x0180ba64 in execute (u=<value optimized out>)
    at /usr/src/dist/nawk/run.c:156
#20 0x018116c4 in program (a=0x1a4ef30, n=<value optimized out>)
    at /usr/src/dist/nawk/run.c:197
#21 0x0180ba64 in execute (u=<value optimized out>)
    at /usr/src/dist/nawk/run.c:156
#22 0x01811784 in run (a=0x1a4ef20) at /usr/src/dist/nawk/run.c:131
#23 0x0180a4a4 in main (argc=19, argv=0xffffd310)
    at /usr/src/dist/nawk/main.c:162
(gdb) frame 2
#2  0x0180332c in freefa (f=0x20e8c00) at /usr/src/dist/nawk/b.c:946
946                     xfree(f->gototab[i])
(gdb) print *f
$1 = {gototab = 0x2603800, out = 0x2690f20 "", 
  restr = 0x2188b00 " glu>=6\\.4\\.1nb1 ", posns = 0x2603880, 
  state_count = 23, anchor = 0, use = 8323, initstat = 2, curstat = 17, 
  accept = 16, re = {{ltype = 270, lval = {i = 0, np = 0x0, up = 0x0}, 
      lfollow = 0x2177720}}}
(gdb) print i
$2 = 15
(gdb) print f->gototab[13]
$3 = (unsigned int *) 0x0
(gdb) print f->gototab[14]
$4 = (unsigned int *) 0x2693000
(gdb) print f->gototab[15]
$5 = (unsigned int *) 0x2693800

	
>How-To-Repeat:
cd /usr/pkgsrc
make readme
	
>Fix:
	

>Unformatted:
 	<synopsis of the problem (one line)>
 	<[ non-critical | serious | critical ] (one line)>
 	<problem report category - see top for list (one line)>
 	<[ sw-bug | doc-bug | change-request | support ] (one line)>