Subject: bin/6485: sup seg faults trying to retrieve current-src
To: None <gnats-bugs@gnats.netbsd.org>
From: None <dave@dtsp.co.nz>
List: netbsd-bugs
Date: 11/23/1998 13:57:43
>Number:         6485
>Category:       bin
>Synopsis:       sup seg faults trying to retrieve current-src
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Nov 23 06:05:01 1998
>Last-Modified:
>Originator:     Dave Sainty
>Organization:
Dynamic Technology Services and Products Ltd
>Release:        sup compiled from sources 16/11/98
>Environment:
>Description:
	Very repeatably sup is segfaulting when it gets to current-src.  This
	first happened on 18/11, the sup worked on 16/11, no sup on the 17th.

	I have tried recompiling the compiler, now gcc version egcs-2.91.58
	19981101 (egcs-1.1.1 pre-release), and then recompiling sup, the
	result is the same.

(gdb) bt
#0  0x4006b3b8 in strcmp ()
#1  0x8bc2 in Tinsertavl (t=0x175534, p=0x1fec60 "src/lib/libutil/ttymsg.c", 
    find=1, dh=0xefbfc358)
    at /vol/tequila/userC/NetBSD-current/src/usr.sbin/sup/lib/../source/stree.c:212
#2  0x8c15 in Tinsertavl (t=0x1757f4, p=0x1fec60 "src/lib/libutil/ttymsg.c", 
    find=1, dh=0xefbfc380)
    at /vol/tequila/userC/NetBSD-current/src/usr.sbin/sup/lib/../source/stree.c:221
#3  0x8c15 in Tinsertavl (t=0x1757b4, p=0x1fec60 "src/lib/libutil/ttymsg.c", 
    find=1, dh=0xefbfc3a8)
    at /vol/tequila/userC/NetBSD-current/src/usr.sbin/sup/lib/../source/stree.c:221
#4  0x8c15 in Tinsertavl (t=0x1758b4, p=0x1fec60 "src/lib/libutil/ttymsg.c", 
    find=1, dh=0xefbfc3d0)
    at /vol/tequila/userC/NetBSD-current/src/usr.sbin/sup/lib/../source/stree.c:221
#5  0x8c15 in Tinsertavl (t=0x175334, p=0x1fec60 "src/lib/libutil/ttymsg.c", 
    find=1, dh=0xefbfc3f8)
    at /vol/tequila/userC/NetBSD-current/src/usr.sbin/sup/lib/../source/stree.c:221
#6  0x8c15 in Tinsertavl (t=0x175fb4, p=0x1fec60 "src/lib/libutil/ttymsg.c", 
    find=1, dh=0xefbfc420)
    at /vol/tequila/userC/NetBSD-current/src/usr.sbin/sup/lib/../source/stree.c:221
#7  0x8c15 in Tinsertavl (t=0x176934, p=0x1fec60 "src/lib/libutil/ttymsg.c", 
    find=1, dh=0xefbfc448)
    at /vol/tequila/userC/NetBSD-current/src/usr.sbin/sup/lib/../source/stree.c:221
#8  0x8c15 in Tinsertavl (t=0x177d74, p=0x1fec60 "src/lib/libutil/ttymsg.c", 
    find=1, dh=0xefbfc470)
    at /vol/tequila/userC/NetBSD-current/src/usr.sbin/sup/lib/../source/stree.c:221
#9  0x8c15 in Tinsertavl (t=0x17a234, p=0x1fec60 "src/lib/libutil/ttymsg.c", 
    find=1, dh=0xefbfc498)
    at /vol/tequila/userC/NetBSD-current/src/usr.sbin/sup/lib/../source/stree.c:221
#10 0x8c15 in Tinsertavl (t=0x1804f4, p=0x1fec60 "src/lib/libutil/ttymsg.c", 
    find=1, dh=0xefbfc4c0)
    at /vol/tequila/userC/NetBSD-current/src/usr.sbin/sup/lib/../source/stree.c:221
#11 0x8c15 in Tinsertavl (t=0x18c3f4, p=0x1fec60 "src/lib/libutil/ttymsg.c", 
    find=1, dh=0xefbfc4e8)
    at /vol/tequila/userC/NetBSD-current/src/usr.sbin/sup/lib/../source/stree.c:221
#12 0x8c15 in Tinsertavl (t=0x1a6d74, p=0x1fec60 "src/lib/libutil/ttymsg.c", 
    find=1, dh=0xefbfc510)
    at /vol/tequila/userC/NetBSD-current/src/usr.sbin/sup/lib/../source/stree.c:221
#13 0x8c15 in Tinsertavl (t=0x110d4, p=0x1fec60 "src/lib/libutil/ttymsg.c", 
    find=1, dh=0xefbfc52c)
    at /vol/tequila/userC/NetBSD-current/src/usr.sbin/sup/lib/../source/stree.c:221
#14 0x8c98 in Tinsert (t=0x110d4, p=0x1fec60 "src/lib/libutil/ttymsg.c", 
    find=1)
    at /vol/tequila/userC/NetBSD-current/src/usr.sbin/sup/lib/../source/stree.c:243
#15 0x81e8 in msglist ()
    at /vol/tequila/userC/NetBSD-current/src/usr.sbin/sup/lib/../source/supmsg.c:337
#16 0x4b47 in listfiles ()
    at /vol/tequila/userC/NetBSD-current/src/usr.sbin/sup/sup/../source/supcmeat.c:516
#17 0x386e in getcoll ()
    at /vol/tequila/userC/NetBSD-current/src/usr.sbin/sup/sup/../source/supcmeat.c:228
#18 0x1995 in main (argc=5, argv=0xefbfd5f0)
    at /vol/tequila/userC/NetBSD-current/src/usr.sbin/sup/sup/../source/supcmain.c:393
(gdb) up
#1  0x8bc2 in Tinsertavl (t=0x175534, p=0x1fec60 "src/lib/libutil/ttymsg.c", 
    find=1, dh=0xefbfc358)
    at /vol/tequila/userC/NetBSD-current/src/usr.sbin/sup/lib/../source/stree.c:212
(gdb) l
207		if (*t == NULL) {
208		    *t = Tmake (p);
209		    *dh = 1;
210		    return (*t);
211		}
212		if ((cmp = strcmp(p, (*t)->Tname)) == 0) {
213		    if (!find)  return (NULL);	/* node already exists */
214		    *dh = 0;
215		    return (*t);
216		} else if (cmp < 0) {
(gdb) print (*t)->Tname 
$1 = 0x0

The file being inserted is not always the same from core to core.  Possibly
depending on what collections were successfully sup'd before current-src.  The
cause of the crash is always a NULL dereference in strcmp though.  For some
reason current-src gets a NULL entry into the tree.  Some time after 16/11.

>How-To-Repeat:
	For me, sup from sup.NetBSD.ORG with:

cat > netbsd-current.sup <<EOF
current release=src host=caesar.sai.dtsp.co.nz hostbase=/a/anon_ftp base=/vol/tequila/userC/NetBSD-sup prefix=/vol/tequila/userC/NetBSD-sup backup use-rel-suffix compress delete notify=dave
EOF
sup -v -N -P netbsd-current.sup

... will do it...

>Fix:
	Sorry, none known...
>Audit-Trail:
>Unformatted:
System: NetBSD tequila.dave.dtsp.co.nz 1.3G NetBSD 1.3G (TEQUILA) #1: Thu Aug 20 00:13:30 NZST 1998 dave@tequila.dave.dtsp.co.nz:/vol/tequila/userC/NetBSD-current/src/sys/arch/i386/compile/TEQUILA i386