From mi@aldan.algebra.com Sun Jun  6 12:08:04 1999
Return-Path: <mi@aldan.algebra.com>
Received: from kot.ne.mediaone.net (kot.ne.mediaone.net [24.218.12.203])
	by hub.freebsd.org (Postfix) with ESMTP id D2AB014DE7
	for <FreeBSD-gnats-submit@freebsd.org>; Sun,  6 Jun 1999 12:07:58 -0700 (PDT)
	(envelope-from mi@aldan.algebra.com)
Received: from rtfm.newton (rtfm.newton [10.10.0.1])
	by kot.ne.mediaone.net (8.9.1a/8.9.1) with ESMTP id PAA18716;
	Sun, 6 Jun 1999 15:07:19 -0400 (EDT)
Received: (from root@localhost)
	by rtfm.newton (8.9.3/8.9.1) id PAA61797;
	Mon, 7 Jun 1999 15:10:11 -0400 (EDT)
Message-Id: <199906071910.PAA61797@rtfm.newton>
Date: Mon, 7 Jun 1999 15:10:11 -0400 (EDT)
From: root@aldan.algebra.com
Sender: mi@aldan.algebra.com
Reply-To: mi@aldan.algebra.com
To: FreeBSD-gnats-submit@freebsd.org
Cc: dan@rn082110.mrs.umn.edu
Subject: explicit -ltermcap after -lncurses causes segfaults
X-Send-Pr-Version: 3.2

>Number:         12054
>Category:       bin
>Synopsis:       explicit -ltermcap after -lncurses causes segfaults
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jun  6 12:10:00 PDT 1999
>Closed-Date:    Tue Jan 8 07:43:19 PST 2002
>Last-Modified:  Tue Jan 08 07:43:20 PST 2002
>Originator:     Mikhail Teterin
>Release:        FreeBSD 3.2-STABLE i386
>Organization:
Virtual Estates, Inc.
>Environment:

>Description:

	The following link line:
	cc -Wall -g -pipe -L/usr/local/lib -o tsiag -L../siod \
		-L../common -L../siag fonts.o forminput.o window.o \
		selection.o tsiag.o -lsiag -lcommon -lsiod -lncurses -lcrypt \
		-L/usr/local/lib -lguile -lreadline -lm -ltcl80 -lgdbm

	results in a runnable executable with the following libs:
	tsiag:
		libncurses.so.3 => /usr/lib/libncurses.so.3 (0x280a9000)
		libcrypt.so.2 => /usr/lib/libcrypt.so.2 (0x280ba000)
		libguile.so.4 => /usr/local/lib/libguile.so.4 (0x280bd000)
		libreadline.so.3 => /usr/lib/libreadline.so.3 (0x2811b000)
		libm.so.2 => /usr/lib/libm.so.2 (0x2813d000)
		libtcl80.so => /usr/local/lib/libtcl80.so (0x28157000)
		libc.so.3 => /usr/lib/libc.so.3 (0x281b9000)
		libmytinfo.so.2 => /usr/lib/libmytinfo.so.2 (0x28239000)
		libtermcap.so.2 => /usr/lib/libtermcap.so.2 (0x2824f000)

	If I explicitly add -ltermcap to the link-line (this library is
	requested by ncurses), which should NOT do any harm, the ldd's
	output is slightly different:
	tsiag:
		libncurses.so.3 => /usr/lib/libncurses.so.3 (0x280a9000)
		libtermcap.so.2 => /usr/lib/libtermcap.so.2 (0x280ba000)
		libcrypt.so.2 => /usr/lib/libcrypt.so.2 (0x280bf000)
		libguile.so.4 => /usr/local/lib/libguile.so.4 (0x280c2000)
		libreadline.so.3 => /usr/lib/libreadline.so.3 (0x28120000)
		libtcl80.so => /usr/local/lib/libtcl80.so (0x28142000)
		libm.so.2 => /usr/lib/libm.so.2 (0x281a4000)
		libc.so.3 => /usr/lib/libc.so.3 (0x281be000)
		libmytinfo.so.2 => /usr/lib/libmytinfo.so.2 (0x2823e000)

	and the executable dies on start-up:

Program received signal SIGSEGV, Segmentation fault.
0x0 in ?? ()
(gdb) where
#0  0x0 in ?? ()
#1  0x280bc1c6 in tputs () from /usr/lib/libtermcap.so.2
#2  0x28245e90 in putp () from /usr/lib/libmytinfo.so.2
#3  0x280b6340 in curs_set () from /usr/lib/libncurses.so.3
#4  0x280afd63 in leaveok () from /usr/lib/libncurses.so.3
#5  0x804e5c5 in new_ncurses () at window.c:617
#6  0x804e7c6 in init_windows (b=0x8145000, argc=0xbfbfd70c, argv=0xbfbfd80c)
    at window.c:701
#7  0x8060baf in realmain (argc=1, argv=0xbfbfd80c) at main.c:147
#8  0x280ead7f in gh_launch_pad () from /usr/local/lib/libguile.so.4
#9  0x280ecef2 in invoke_main_func () from /usr/local/lib/libguile.so.4
#10 0x2810f8d3 in scm_internal_lazy_catch () from /usr/local/lib/libguile.so.4
#11 0x280eceae in scm_boot_guile_1 () from /usr/local/lib/libguile.so.4
#12 0x280ecc65 in scm_boot_guile () from /usr/local/lib/libguile.so.4
#13 0x280eadad in gh_enter () from /usr/local/lib/libguile.so.4
#14 0x8060db1 in main (argc=1, argv=0xbfbfd80c) at main.c:203
#15 0x804ba25 in _start ()

>How-To-Repeat:

	I'm trying to update the math/siag port to the latest
	Siag-3.1.16, but you can probably reproduce this with
	anything that uses ncurses.

	I  do not  believe  this to  be  Siag's problem  --  the
	-ltermcap  is redundant but should be harmless, AFAIK.

>Fix:
	
	Do NOT use the explicit -ltermcap, but this _may_ break some
	Makefiles, which do this for compatability with other systems.

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: mike 
State-Changed-When: Fri Jul 20 15:33:34 PDT 2001 
State-Changed-Why:  

Does this problem still occur in newer versions of FreeBSD, 
such as 4.3-RELEASE? 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=12054 
State-Changed-From-To: feedback->closed 
State-Changed-By: des 
State-Changed-When: Tue Jan 8 07:43:19 PST 2002 
State-Changed-Why:  
Feedback timeout, and the problem does not seem to exist any more. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=12054 
>Unformatted:
