NetBSD Problem Report #57365

From www@netbsd.org  Tue Apr 18 10:55:55 2023
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 5D0A71A9239
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 18 Apr 2023 10:55:55 +0000 (UTC)
Message-Id: <20230418105554.16D401A923A@mollari.NetBSD.org>
Date: Tue, 18 Apr 2023 10:55:54 +0000 (UTC)
From: ci4ic4@gmail.com
Reply-To: ci4ic4@gmail.com
To: gnats-bugs@NetBSD.org
Subject: shells/fish crash when CURSES_DEFAULT is ncurses
X-Send-Pr-Version: www-1.0

>Number:         57365
>Category:       pkg
>Synopsis:       shells/fish crash when CURSES_DEFAULT is ncurses
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          feedback
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Apr 18 11:00:01 +0000 2023
>Closed-Date:    
>Last-Modified:  Tue May 09 23:26:30 +0000 2023
>Originator:     Chavdar Ivanov
>Release:        pkgsrc -current as of 17/04/2023
>Organization:
CI4 Consulting Ltd
>Environment:
NetBSD ymir.lorien.lan 10.99.3 NetBSD 10.99.3 (GENERIC) #3: Thu Apr 13 14:24:47 BST 2023  sysbuild@ymir.lorien.lan:/dumps/sysbuild/amd64/obj/home/sysbuild/src/sys/arch/amd64/compile/GENERIC amd64
>Description:
The package Makefile includes unconditional libterminfo linking under NetBSD. This clashes with the ncurses terminfo routines and is necessary only when the buildint curses is used. The trace looks like:
...
Thread 1 (LWP 20753 of process 20753 ""):
#0  0x000076ee2e4fef13 in _ti_parm_analyse () from /usr/lib/libterminfo.so.2
#1  0x000076ee2e4ff04d in ?? () from /usr/lib/libterminfo.so.2
#2  0x000076ee2e4ffda4 in ?? () from /usr/lib/libterminfo.so.2
#3  0x000000000021f5d0 in screen_t::reset_abandoning_line (this=this@entry=0x76ee2d9fb478, screen_width=158) at /usr/include/g++/ext/new_allocator.h:79
#4  0x000000000021c244 in reader_data_t::readline[abi:cxx11](int) (this=0x76ee2d9fb010, nchars_or_0=nchars_or_0@entry=0) at /usr/pkgsrc/shells/fish/work/fish-3.6.1/src/reader.cpp:4415
#5  0x000000000021d191 in read_i (parser=...) at /usr/include/g++/bits/shared_ptr_base.h:1329
#6  reader_read (parser=..., fd=fd@entry=0, io=...) at /usr/pkgsrc/shells/fish/work/fish-3.6.1/src/reader.cpp:4762
#7  0x00000000002c8732 in main (argc=<optimized out>, argv=0x7f7fffa6c958) at /usr/pkgsrc/shells/fish/work/fish-3.6.1/src/fish.cpp:571

Thanks to rvp@sdf.org for the analysis. 
>How-To-Repeat:
Build shells/fish v3.6.1 with CURSES_DEFAULT=ncurses.
>Fix:
Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/shells/fish/Makefile,v
retrieving revision 1.42
diff -u -r1.42 Makefile
--- Makefile    29 Mar 2023 09:39:02 -0000      1.42
+++ Makefile    18 Apr 2023 10:54:29 -0000
@@ -28,7 +28,9 @@
 CXXFLAGS.NetBSD+=      -fpermissive
 LDFLAGS+=              -lexecinfo
 .endif
+.if ${CURSES_DEFAULT} != "ncurses"
 LDFLAGS.NetBSD+=       -lterminfo
+.endif

 # Upstream intentionally omits open.1 on Darwin, but adds realpath.1
 PLIST_VARS+=   open realpath
cvs diff: Diffing patches

>Release-Note:

>Audit-Trail:
From: David Holland <dholland-pbugs@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: pkg-manager@netbsd.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org
Subject: Re: pkg/57365: shells/fish crash when CURSES_DEFAULT is ncurses
Date: Tue, 9 May 2023 23:20:42 +0000

 On Tue, Apr 18, 2023 at 11:00:01AM +0000, ci4ic4@gmail.com wrote:
  > +.if ${CURSES_DEFAULT} != "ncurses"
  >  LDFLAGS.NetBSD+=       -lterminfo
  > +.endif

 This should be keyed to CURSES_TYPE (chosen by curses.bl3.mk) rather
 than the default setting, since at least in theory the resolved type
 might be different and that's the one we want.

 ...also it should be LIBS and not LDFLAGS :-)

 -- 
 David A. Holland
 dholland@netbsd.org

From: "David A. Holland" <dholland@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/57365 CVS commit: pkgsrc/shells/fish
Date: Tue, 9 May 2023 23:23:37 +0000

 Module Name:	pkgsrc
 Committed By:	dholland
 Date:		Tue May  9 23:23:37 UTC 2023

 Modified Files:
 	pkgsrc/shells/fish: Makefile

 Log Message:
 shells/fish: fix ncurses linkage, from Chavdar Ivanov and RVP in PR 57365

 Only add -lterminfo when using base curses on NetBSD, not ncurses.
 Also put it in LIBS, not LDFLAGS :-)

 The previous behavior gives a bad build, but only with non-default
 settings, so I'm not bumping the revision.

 XXX: the magic to add -lterminfo probably belongs in curses.bl3.mk


 To generate a diff of this commit:
 cvs rdiff -u -r1.42 -r1.43 pkgsrc/shells/fish/Makefile

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->feedback
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Tue, 09 May 2023 23:26:30 +0000
State-Changed-Why:
fixed slightly differently, please crosscheck that it works just in case :-)


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2023 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.