Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 4 May 2014 07:58:03 +0530 (IST)
From:      Ashish SHUKLA <ashish@FreeBSD.org>
To:        FreeBSD-gnats-submit@freebsd.org
Cc:        sunpoet@FreeBSD.org
Subject:   ports/189326: [PATCH] net/mtr segfaults with ncurses installed from ports
Message-ID:  <15248783939851027084.enqueue@chateau.d.if>
Resent-Message-ID: <201405040230.s442U0Y8027208@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         189326
>Category:       ports
>Synopsis:       [PATCH] net/mtr segfaults with ncurses installed from ports
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun May 04 02:30:00 UTC 2014
>Closed-Date:
>Last-Modified:
>Originator:     Ashish SHUKLA
>Release:        FreeBSD 9.2-RELEASE-p4 amd64
>Organization:
The FreeBSD Project
>Environment:
System: FreeBSD chateau.d.if 9.2-RELEASE-p4 FreeBSD 9.2-RELEASE-p4 #1: Wed Apr 9 06:41:45 IST 2014 root@chateau.d.if:/usr/obj/usr/src/sys/CHATEAU amd64

λ make -C /usr/ports/net/mtr-nox11 showconfig 
===> The following configuration options are available for mtr-nox11-0.85_1:
     GLIB=on: Build with glib library
     IPV6=on: IPv6 protocol support
===> Use 'make config' to modify these settings
>Description:
λ sudo gdb $(which mtr )                                             
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 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 "amd64-marcel-freebsd"...
(gdb) run google.com
Starting program: /usr/local/sbin/mtr google.com
[New LWP 101095]
[New Thread 802007400 (LWP 101095/mtr)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 802007400 (LWP 101095/mtr)]
0x0000000800f6ed40 in _nc_init_acs () from /usr/local/lib/libtinfo.so.5.9
(gdb) bt
#0  0x0000000800f6ed40 in _nc_init_acs () from /usr/local/lib/libtinfo.so.5.9
#1  0x00000008011b9c5f in _nc_setupscreen () from /lib/libncurses.so.8
#2  0x00000008011aa5db in newterm () from /lib/libncurses.so.8
#3  0x00000008011a79a9 in initscr () from /lib/libncurses.so.8
#4  0x00000000004047c9 in mtr_curses_open () at curses.c:677
#5  0x000000000040b292 in display_open () at display.c:99
#6  0x0000000000405668 in main (argc=2, argv=0x7fffffffdb38) at mtr.c:679
λ ldd $(which mtr)
/usr/local/sbin/mtr:
        libglib-2.0.so.0 => /usr/local/lib/libglib-2.0.so.0 (0x80082b000)
        libintl.so.9 => /usr/local/lib/libintl.so.9 (0x800b33000)
        libm.so.5 => /lib/libm.so.5 (0x800d3d000)
        libtinfo.so.5.9 => /usr/local/lib/libtinfo.so.5.9 (0x800f5e000)
        libncurses.so.8 => /lib/libncurses.so.8 (0x801190000)
        libc.so.7 => /lib/libc.so.7 (0x8013de000)
        libpcre.so.3 => /usr/local/lib/libpcre.so.3 (0x801739000)
        libiconv.so.3 => /usr/local/lib/libiconv.so.3 (0x80199d000)
        libthr.so.3 => /lib/libthr.so.3 (0x801c96000)

After applying the fix:

λ ldd $(which mtr)                 
/usr/local/sbin/mtr:
        libncurses.so.5.9 => /usr/local/lib/libncurses.so.5.9 (0x80082b000)
        libtinfo.so.5.9 => /usr/local/lib/libtinfo.so.5.9 (0x800a48000)
        libglib-2.0.so.0 => /usr/local/lib/libglib-2.0.so.0 (0x800c7a000)
        libintl.so.9 => /usr/local/lib/libintl.so.9 (0x800f82000)
        libm.so.5 => /lib/libm.so.5 (0x80118c000)
        libncurses.so.8 => /lib/libncurses.so.8 (0x8013ad000)
        libc.so.7 => /lib/libc.so.7 (0x8015fb000)
        libpcre.so.3 => /usr/local/lib/libpcre.so.3 (0x801956000)
        libiconv.so.3 => /usr/local/lib/libiconv.so.3 (0x801bba000)
        libthr.so.3 => /lib/libthr.so.3 (0x801eb3000)
>How-To-Repeat:
1. Install devel/ncurses port.
2. Install net/mtr-nox11 port.
3. Execute: mtr some-host-name
>Fix:
Index: Makefile
===================================================================
--- Makefile	(revision 352935)
+++ Makefile	(working copy)
@@ -19,7 +19,7 @@
 X11_DESC=	Build X11-enabled mtr
 
 GNU_CONFIGURE=	yes
-USES=		pkgconfig
+USES=		pkgconfig ncurses
 
 PLIST_FILES=	man/man8/mtr.8.gz \
 		sbin/mtr
@@ -30,6 +30,7 @@
 IPV6_CONFIGURE_ENABLE=	ipv6
 X11_CONFIGURE_WITH=	gtk
 X11_USE=		GNOME=gtk20
+LDFLAGS+=	-lncurses
 
 .include <bsd.port.options.mk>
 

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?15248783939851027084.enqueue>