NetBSD Problem Report #54460

From www@netbsd.org  Tue Aug 13 14:48:02 2019
Return-Path: <www@netbsd.org>
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 A9C007A1E4
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 13 Aug 2019 14:48:02 +0000 (UTC)
Message-Id: <20190813144801.E885B7A1EA@mollari.NetBSD.org>
Date: Tue, 13 Aug 2019 14:48:01 +0000 (UTC)
From: joernc@gmail.com
Reply-To: joernc@gmail.com
To: gnats-bugs@NetBSD.org
Subject: pkg_chk mixes non-default installation with /usr/pkg(src)
X-Send-Pr-Version: www-1.0

>Number:         54460
>Category:       pkg
>Synopsis:       pkg_chk mixes non-default installation with /usr/pkg(src)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    abs
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Aug 13 14:50:00 +0000 2019
>Last-Modified:  Tue Aug 13 23:55:38 +0000 2019
>Originator:     Joern Clausen
>Release:        
>Organization:
>Environment:
>Description:
See this mail thread for context: https://mail-index.netbsd.org/netbsd-users/2019/08/08/msg023310.html

When installing pkgsrc with a non-default prefix (LOCALBASE) on NetBSD, and a native pkgsrc installation with /usr/pkg, /usr/pkgsrc and /etc/mk.conf is present, the non-default pkg_chk will find and use configuration and packages from the native installation. It will read both LOCALBASE/pkgchk.conf and /usr/pkgsrc/pkgchk.conf. It will try to install packages from /usr/pkgsrc/packages/All, although they will not work if installed under LOCALBASE.

The problem seems to stem from the fact, that extract_mk_var() does not return correct values for LOCALBASE and PKGSRCDIR. The function returns the empty default values, making pkg_chk use the native installation instead.

A workaround is to define PKGSRCDIR in $prefix/etc/mk.conf (as LOCALBASE already is), and pkg_chk works as intended. Another, eventually better solution would be to bake the proper values into the pkg_chk script, as is already done for several other variables.
>How-To-Repeat:

>Fix:

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: pkg-manager->abs
Responsible-Changed-By: leot@NetBSD.org
Responsible-Changed-When: Tue, 13 Aug 2019 23:55:38 +0000
Responsible-Changed-Why:
David, can you please give it a look?
(Over to OWNER)


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.