NetBSD Problem Report #55865

From mlelstv@tazz.1st.de  Sat Dec 12 08:49:07 2020
Return-Path: <mlelstv@tazz.1st.de>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-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 45E131A923E
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 12 Dec 2020 08:49:07 +0000 (UTC)
Message-Id: <20201212084832.A0D34CCAE5@tazz.1st.de>
Date: Sat, 12 Dec 2020 09:48:32 +0100 (CET)
From: mlelstv@serpens.de
Reply-To: mlelstv@serpens.de
To: gnats-bugs@NetBSD.org
Subject: pkg_add segfaults
X-Send-Pr-Version: 3.95

>Number:         55865
>Category:       bin
>Synopsis:       pkg_add segfaults
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Dec 12 08:50:01 +0000 2020
>Closed-Date:    
>Last-Modified:  Thu Dec 17 19:00:02 +0000 2020
>Originator:     Michael van Elst
>Release:        NetBSD 9.99.76
>Organization:

>Environment:


System: NetBSD tazz 9.99.76 NetBSD 9.99.76 (GENERIC) #4: Sun Dec 6 14:41:55 UTC 2020 mlelstv@slowpoke:/scratch2/obj.amd64/scratch/netbsd-current/src/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:
Installing a package with a dependency that doesn't exist in the repository causes a segfault.

The check_dependencies() function includes:

	best_installed = find_best_matching_installed_pkg(p->name, 0);

	for (i = 0; i < pkg->dep_length; ++i) {
		if (strcmp(best_installed, pkg->dependencies[i]) == 0)
		break;
	}
	...
	pkg->dependencies[pkg->dep_length++] = best_installed;


where best_installed can be NULL and so can pkg->dependencies[i] later.

The previous handling of NULL results was dropped in the last change
to perform.c.

>How-To-Repeat:
pkg_add ./rsync-3.2.3.tgz
pkg_add: Warning: package `rsync-3.2.3' was built for a platform:
pkg_add: NetBSD/x86_64 9.0 (pkg) vs. NetBSD/x86_64 9.99.76 (this host)
pkg_add: no pkg found for 'bash-[0-9]*', sorry.
pkg_add: Can't install dependency bash-[0-9]*
Segmentation fault (core dumped)
>Fix:


>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->closed
State-Changed-By: wiz@NetBSD.org
State-Changed-When: Sat, 12 Dec 2020 10:06:49 +0000
State-Changed-Why:
Already fixed, please update your pkgsrc.

Module Name:    pkgsrc
Committed By:   wiz
Date:           Sun Dec  6 17:23:09 UTC 2020

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

Log Message:
pkg_install: update to 20201206

Convert a core dump I've been seeing into an error abort.


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 pkgsrc/pkgtools/pkg_install/files/add/perform.c
cvs rdiff -u -r1.181 -r1.182 pkgsrc/pkgtools/pkg_install/files/lib/version.h


State-Changed-From-To: closed->open
State-Changed-By: mlelstv@NetBSD.org
State-Changed-When: Sat, 12 Dec 2020 10:40:31 +0000
State-Changed-Why:
This is a bug report against NetBSD, not pkgsrc upstream.


From: "Thomas Klausner" <wiz@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/55865 CVS commit: src/external/bsd/pkg_install/dist
Date: Sat, 12 Dec 2020 10:59:13 +0000

 Module Name:	src
 Committed By:	wiz
 Date:		Sat Dec 12 10:59:13 UTC 2020

 Update of /cvsroot/src/external/bsd/pkg_install/dist
 In directory ivanova.netbsd.org:/tmp/cvs-serv25140

 Log Message:
 pkg_install: import version 20201212 from pkgsrc

 Two bugfixes and a check_os_version config variable.

 Addresses PR 55865

 Status:

 Vendor Tag:	PKGSRC
 Release Tags:	pkg_install-20201212

 U src/external/bsd/pkg_install/dist/add/add.h
 U src/external/bsd/pkg_install/dist/add/main.c
 C src/external/bsd/pkg_install/dist/add/perform.c
 U src/external/bsd/pkg_install/dist/add/pkg_add.1
 U src/external/bsd/pkg_install/dist/admin/audit-packages.8
 U src/external/bsd/pkg_install/dist/admin/admin.h
 U src/external/bsd/pkg_install/dist/admin/audit-packages.sh.in
 U src/external/bsd/pkg_install/dist/admin/audit.c
 U src/external/bsd/pkg_install/dist/admin/check.c
 U src/external/bsd/pkg_install/dist/admin/download-vulnerability-list.sh.in
 U src/external/bsd/pkg_install/dist/admin/download-vulnerability-list.8
 U src/external/bsd/pkg_install/dist/admin/main.c
 U src/external/bsd/pkg_install/dist/admin/pkg_admin.1
 C src/external/bsd/pkg_install/dist/lib/parse-config.c
 U src/external/bsd/pkg_install/dist/lib/automatic.c
 U src/external/bsd/pkg_install/dist/lib/config.h.in
 U src/external/bsd/pkg_install/dist/lib/conflicts.c
 U src/external/bsd/pkg_install/dist/lib/defs.h
 U src/external/bsd/pkg_install/dist/lib/dewey.c
 U src/external/bsd/pkg_install/dist/lib/dewey.h
 U src/external/bsd/pkg_install/dist/lib/fexec.c
 U src/external/bsd/pkg_install/dist/lib/file.c
 U src/external/bsd/pkg_install/dist/lib/global.c
 U src/external/bsd/pkg_install/dist/lib/gpgsig.c
 U src/external/bsd/pkg_install/dist/lib/iterate.c
 C src/external/bsd/pkg_install/dist/lib/lib.h
 U src/external/bsd/pkg_install/dist/lib/license.c
 U src/external/bsd/pkg_install/dist/lib/lpkg.c
 U src/external/bsd/pkg_install/dist/lib/opattern.c
 U src/external/bsd/pkg_install/dist/lib/pkcs7.c
 U src/external/bsd/pkg_install/dist/lib/pkg_io.c
 U src/external/bsd/pkg_install/dist/lib/vulnerabilities-file.c
 C src/external/bsd/pkg_install/dist/lib/pkg_install.conf.5.in
 U src/external/bsd/pkg_install/dist/lib/pkg_signature.c
 U src/external/bsd/pkg_install/dist/lib/pkg_summary.5
 U src/external/bsd/pkg_install/dist/lib/pkgdb.c
 U src/external/bsd/pkg_install/dist/lib/pkgsrc.7
 U src/external/bsd/pkg_install/dist/lib/plist.c
 U src/external/bsd/pkg_install/dist/lib/remove.c
 U src/external/bsd/pkg_install/dist/lib/str.c
 U src/external/bsd/pkg_install/dist/lib/var.c
 U src/external/bsd/pkg_install/dist/lib/version.c
 C src/external/bsd/pkg_install/dist/lib/version.h
 U src/external/bsd/pkg_install/dist/lib/xwrapper.c
 U src/external/bsd/pkg_install/dist/create/build.c
 U src/external/bsd/pkg_install/dist/create/create.h
 U src/external/bsd/pkg_install/dist/create/main.c
 U src/external/bsd/pkg_install/dist/create/perform.c
 U src/external/bsd/pkg_install/dist/create/pkg_create.1
 U src/external/bsd/pkg_install/dist/create/util.c
 U src/external/bsd/pkg_install/dist/create/pl.c
 U src/external/bsd/pkg_install/dist/delete/pkg_delete.1
 U src/external/bsd/pkg_install/dist/delete/pkg_delete.c
 U src/external/bsd/pkg_install/dist/info/info.h
 U src/external/bsd/pkg_install/dist/info/main.c
 U src/external/bsd/pkg_install/dist/info/perform.c
 U src/external/bsd/pkg_install/dist/info/pkg_info.1
 U src/external/bsd/pkg_install/dist/info/show.c
 U src/external/bsd/pkg_install/dist/x509/pkgsrc.cnf
 U src/external/bsd/pkg_install/dist/x509/pkgsrc.sh
 U src/external/bsd/pkg_install/dist/x509/signing.txt

 5 conflicts created by this import.
 Use the following command to help the merge:

 	cvs checkout -jPKGSRC:yesterday -jPKGSRC src/external/bsd/pkg_install/dist

From: "David H. Gutteridge" <david@gutteridge.ca>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/55865 (pkg_add segfaults)
Date: Thu, 17 Dec 2020 13:56:22 -0500

 There's a related failure mode here, involving packages that are all
 available for installation, but cannot be installed together because
 of conflicts between them. Unfortunately, this is for example now
 happening with meta-pkgs/mate, viz.:

 pkg_add: Installed package `py38-cairo-1.20.0' conflicts with 
 `py27-cairo-[0-9]*' when trying to install `py27-cairo-1.18.2nb1'.
 pkg_add: Can't install dependency py27-cairo>=1.18.2nb1
 [1]   Segmentation fault (core dumped) PKG_PATH=${packages}/All 
 ${pkg_add} -K ${cur_p...

 (The reason why this particular example conflict is occurring is new,
 and outside the bounds of this PR, of course.)

 I haven't traced this (yet) to see if the cause is the same code point
 in add/perform.c, but I think it has to be. wiz@ had committed a related
 fix, though I had some questions/observations about it -- it wasn't
 clear to me what the functional intentions were when this code was last
 rewritten (which created the conditions for these NPEs to occur).

 Anyway, related fixes to issues have been imported into -current, but
 haven't been pulled up to 8- and 9-, that's mostly why I mention this.

 (Re-sending this email, as I mistakenly referred to pkg/55865 rather
 than bin/55865, and I infer GNATS is not able to figure out these are
 the same, and it has gone to some NetBSD GNATS administrator purgatory
 that I can find no documentation on and probably have no access to.
 GNATS is often not very pleasant to deal with. My apologies if this
 results in doubled posts.)

 Dave


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.