NetBSD Problem Report #58433

From www@netbsd.org  Tue Jul 16 17:11:35 2024
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)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id CE4FB1A9239
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 16 Jul 2024 17:11:35 +0000 (UTC)
Message-Id: <20240716171134.D33631A923A@mollari.NetBSD.org>
Date: Tue, 16 Jul 2024 17:11:34 +0000 (UTC)
From: bruno@haible.de
Reply-To: bruno@haible.de
To: gnats-bugs@NetBSD.org
Subject: pkg_add segmentation fault
X-Send-Pr-Version: www-1.0

>Number:         58433
>Category:       pkg
>Synopsis:       pkg_add segmentation fault
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jul 16 17:15:00 +0000 2024
>Last-Modified:  Mon Dec 02 20:10:00 +0000 2024
>Originator:     Bruno Haible
>Release:        10.0
>Organization:
GNU
>Environment:
NetBSD ***** 10.0 NetBSD 10.0 (GENERIC) #0: Thu Mar 28 08:33:33 UTC 2024  mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64
>Description:
This command, run as root

/usr/sbin/pkg_add gjs

produces some output, ending in

/usr/pkg/lib/libgtk-3.so.0: Shared object "libfontconfig.so.2" not found

and then crashes with a segmentation fault.

>How-To-Repeat:
/usr/sbin/pkg_add gjs
>Fix:

>Audit-Trail:
From: Thomas Klausner <wiz@NetBSD.org>
To: NetBSD bugtracking <gnats-bugs@NetBSD.org>
Cc: 
Subject: Re: pkg/58433: pkg_add segmentation fault
Date: Wed, 17 Jul 2024 14:44:14 +0200

 Did you install the X sets when installing NetBSD?

 I think the published binary packages assume that those are installed
 and this looks like it might be related to this.

 (Not that I think that the core dump is proper behaviour, but just to
 get you further along in what you wanted to do.)
  Thomas

From: Bruno Haible <bruno@clisp.org>
To: pkg-manager@netbsd.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org, gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/58433: pkg_add segmentation fault
Date: Wed, 17 Jul 2024 14:50:31 +0200

 >  Did you install the X sets when installing NetBSD?

 No.



From: Thomas Klausner <wiz@NetBSD.org>
To: NetBSD bugtracking <gnats-bugs@NetBSD.org>
Cc: 
Subject: Re: pkg/58433: pkg_add segmentation fault
Date: Wed, 17 Jul 2024 14:58:13 +0200

 On Wed, Jul 17, 2024 at 12:55:02PM +0000, Bruno Haible wrote:
 > The following reply was made to PR pkg/58433; it has been noted by GNATS.
 > 
 > From: Bruno Haible <bruno@clisp.org>
 > To: pkg-manager@netbsd.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org, gnats-bugs@netbsd.org
 > Cc: 
 > Subject: Re: pkg/58433: pkg_add segmentation fault
 > Date: Wed, 17 Jul 2024 14:50:31 +0200
 > 
 >  >  Did you install the X sets when installing NetBSD?
 >  
 >  No.

 Do, if you want to use the binary packages.
  Thomas

From: Bruno Haible <bruno@clisp.org>
To: pkg-manager@netbsd.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org, gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/58433: pkg_add segmentation fault
Date: Wed, 17 Jul 2024 15:41:42 +0200

 >  >  >  Did you install the X sets when installing NetBSD?
 >  >  
 >  >  No.
 >  
 >  Do, if you want to use the binary packages.

 First and foremost, I want a package manager that tells me through
 an error message if it cannot install some package.



From: Thomas Klausner <wiz@gatalith.at>
To: NetBSD bugtracking <gnats-bugs@NetBSD.org>
Cc: 
Subject: Re: pkg/58433: pkg_add segmentation fault
Date: Wed, 17 Jul 2024 15:50:16 +0200

 >  First and foremost, I want a package manager that tells me through
 >  an error message if it cannot install some package.

 I understand your frustration, and I agree that the core dump is bad.

 The recommended package manager for pkgsrc is pkgin though, not
 pkg_add directly.
  Thomas

From: =?UTF-8?Q?J=C3=B6rg_Sonnenberger?= <joerg@bec.de>
To: gnats-bugs@netbsd.org, pkg-manager@netbsd.org, gnats-admin@netbsd.org,
 pkgsrc-bugs@netbsd.org, bruno@haible.de
Cc: 
Subject: Re: pkg/58433: pkg_add segmentation fault
Date: Thu, 18 Jul 2024 00:27:41 +0200

 On 7/17/24 3:45 PM, Bruno Haible wrote:
 > The following reply was made to PR pkg/58433; it has been noted by GNATS.
 > 
 > From: Bruno Haible <bruno@clisp.org>
 > To: pkg-manager@netbsd.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org, gnats-bugs@netbsd.org
 > Cc:
 > Subject: Re: pkg/58433: pkg_add segmentation fault
 > Date: Wed, 17 Jul 2024 15:41:42 +0200
 > 
 >   >  >  >  Did you install the X sets when installing NetBSD?
 >   >  >
 >   >  >  No.
 >   >
 >   >  Do, if you want to use the binary packages.
 >   
 >   First and foremost, I want a package manager that tells me through
 >   an error message if it cannot install some package.

 But it isn't pkg_add that's segfaulting, but something
 using libgtk-3.so.0.

 Joerg

From: Bruno Haible <bruno@clisp.org>
To: gnats-bugs@netbsd.org, pkg-manager@netbsd.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org, =?ISO-8859-1?Q?J=F6rg?= Sonnenberger <joerg@bec.de>
Cc: 
Subject: Re: pkg/58433: pkg_add segmentation fault
Date: Thu, 18 Jul 2024 05:56:44 +0200

 J=F6rg Sonnenberger wrote:
 > But it isn't pkg_add that's segfaulting, but something
 > using libgtk-3.so.0.

 No. See:

 # pkg_add gjs
 =2E..
 # echo $?
 139




From: "Thomas Klausner" <wiz@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/58433 CVS commit: pkgsrc/pkgtools/pkg_install/files
Date: Sun, 25 Aug 2024 06:08:01 +0000

 Module Name:	pkgsrc
 Committed By:	wiz
 Date:		Sun Aug 25 06:08:01 UTC 2024

 Modified Files:
 	pkgsrc/pkgtools/pkg_install/files/add: perform.c
 	pkgsrc/pkgtools/pkg_install/files/lib: version.h

 Log Message:
 pkg_install: check REQUIRES lines on installation

 Fail if any of the required libraries is missing; in particular,
 for files from the X set on NetBSD, suggest installing the X sets.

 Should fix PR 58433.


 To generate a diff of this commit:
 cvs rdiff -u -r1.122 -r1.123 pkgsrc/pkgtools/pkg_install/files/add/perform.c
 cvs rdiff -u -r1.193 -r1.194 pkgsrc/pkgtools/pkg_install/files/lib/version.h

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

From: Taylor R Campbell <riastradh@NetBSD.org>
To: Bruno Haible <bruno@haible.de>,
	=?UTF-8?Q?J=C3=B6rg_Sonnenberger?= <joerg@bec.de>,
	Thomas Klausner <wiz@NetBSD.org>
Cc: gnats-bugs@NetBSD.org, pkgsrc-bugs@NetBSD.org
Subject: Re: pkg/58433: pkg_add segmentation fault
Date: Mon, 2 Dec 2024 20:07:04 +0000

 There are actually two issues here:

 1. The failure mode for missing xbase was confusing.

    We have now addressed this by checking REQUIRES -- although the
    check is now tripping over other problems because, e.g., the gcc10
    package's REQUIRES entries are broken, PR pkg/58857: gcc10-libs
    REQUIRES libraries so it cannot be added wth new pkg_add.  So we
    might have to revert that, or weaken the check, if we can't fix
    gcc>=3D10 promptly.

 2. pkg_add(8) proceeded to crash with SIGSEGV for reasons unrelated to
    the missing shared library.

    This turns out to be another instance of PR pkg/57179: occasional
    pkg_add core dumps, which was a bug in libfetch that is now fixed
    and pulled up to netbsd-10 to be included in the imminent 10.1
    release.

 Here's the stack trace I got out of a core dump by following the steps
 to reproduce on 10.0 exactly, without `-vvv' which happens to suppress
 the symptoms of (2) but is more helpful for diagnosing (1), confirming
 that (2) matches PR 57179:

 $ gdb -batch -ex bt /usr/sbin/pkg_add /usr/pkg/pkg_add.core
 [New process 26694]
 Core was generated by `pkg_add'.
 Program terminated with signal SIGSEGV, Segmentation fault.
 #0  0x000076fbd35824ab in strcmp () from /usr/lib/libc.so.12
 #0  0x000076fbd35824ab in strcmp () from /usr/lib/libc.so.12
 #1  0x000076fbd5a097c0 in fetch_cache_put (conn=3D0x76fbd64bfc00, closecb=
 =3D0x76fbd5a09f97 <fetch_close>) at /usr/src/external/bsd/fetch/dist/libfet=
 ch/common.c:411
 #2  0x000076fbd5a046eb in http_closefn (v=3D0x76fbd5c70bb0) at /usr/src/ext=
 ernal/bsd/fetch/dist/libfetch/http.c:331
 #3  0x000076fbd5a0a99c in fetchIO_close (f=3D0x76fbd64647e0) at /usr/src/ex=
 ternal/bsd/fetch/dist/libfetch/common.c:1032
 #4  0x000000010b00e96b in fetch_archive_close (a=3D<optimized out>, client_=
 data=3D0x76fbd5cc0dc0) at /usr/src/external/bsd/pkg_install/dist/lib/pkg_io=
 .c:138
 #5  0x000076fbd4a7e16b in client_close_proxy (self=3D<optimized out>) at /u=
 sr/src/external/bsd/libarchive/dist/libarchive/archive_read.c:257
 #6  client_close_proxy (self=3D0x76fbd64a5fc0) at /usr/src/external/bsd/lib=
 archive/dist/libarchive/archive_read.c:248
 #7  0x000076fbd4a7e324 in close_filters (a=3D<optimized out>, a=3D<optimize=
 d out>) at /usr/src/external/bsd/libarchive/dist/libarchive/archive_read.c:=
 1009
 #8  0x000076fbd4a7e3af in _archive_read_close (_a=3D0x76fbd64e1a00) at /usr=
 /src/external/bsd/libarchive/dist/libarchive/archive_read.c:1069
 #9  0x000076fbd4a7eedb in _archive_read_free (_a=3D0x76fbd64e1a00) at /usr/=
 src/external/bsd/libarchive/dist/libarchive/archive_read.c:1094
 #10 _archive_read_free (_a=3D0x76fbd64e1a00) at /usr/src/external/bsd/libar=
 chive/dist/libarchive/archive_read.c:1080
 #11 0x000000010b006c7f in pkg_do (pkgpath=3D<optimized out>, mark_automatic=
 =3D0, top_level=3Dtop_level@entry=3D1) at /usr/src/external/bsd/pkg_install=
 /dist/add/perform.c:1602
 #12 0x000000010b008354 in pkg_perform (pkgs=3Dpkgs@entry=3D0x7f7fff570020) =
 at /usr/src/external/bsd/pkg_install/dist/add/perform.c:1617
 #13 0x000000010b0119fd in main (argc=3D<optimized out>, argv=3D<optimized o=
 ut>) at /usr/src/external/bsd/pkg_install/dist/add/main.c:201

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-2024 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.