NetBSD Problem Report #53897

From martin@duskware.de  Mon Jan 21 11:06:43 2019
Return-Path: <martin@duskware.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 1F6FD7A154
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 21 Jan 2019 11:06:43 +0000 (UTC)
Message-Id: <20190121110633.30CE85CC816@emmas.aprisoft.de>
Date: Mon, 21 Jan 2019 12:06:33 +0100 (CET)
From: martin@NetBSD.org
Reply-To: martin@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: tools/pkg_chk bug with python multi-version pkgs
X-Send-Pr-Version: 3.95

>Number:         53897
>Category:       pkg
>Synopsis:       tools/pkg_chk bug with python multi-version pkgs
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jan 21 11:10:00 +0000 2019
>Last-Modified:  Fri Jan 25 08:45:01 +0000 2019
>Originator:     Martin Husemann
>Release:        NetBSD 8.99.30
>Organization:
The NetBSD Foundation, Inc.
>Environment:
System: NetBSD painkiller.duskware.de 8.99.30 NetBSD 8.99.30 (GENERIC64) #23: Fri Jan 18 13:24:51 CET 2019 martin@seven-days-to-the-wolves.aprisoft.de:/work/src/sys/arch/evbarm/compile/GENERIC64 evbarm
Architecture: aarch64
Machine: evbarm
>Description:

I just noticed pkg_chk always tries to install some strange pkgs for me that
I don't care about. Runing with -v and digging a bit shows that a different
version variant of that pkg being installed triggers it.

>How-To-Repeat:

On a machine with no py*roman* pkg installed and PYTHON_DEFAULT_VERSION=37
in /etc/mk.conf, install a variant of that pkg for PYTHON_VERSION_27, like:

  cd math/py-roman && make PYTHON_DEFAULT_VERSION=27 clean install

then, with a pkgchk.conf that does not contain any math/py-roman variant,
run something like pkg_chk -r.

Notice that the installed (strange) version pkg makes it check the pkgsrc
dir and extract the default version, and will force it to install that
later (if using other options):

Variable: PKGNAME = py37-roman-3.1
math/py-roman - py37-roman-3.1 missing


>Fix:
n/a

>Audit-Trail:
From: "John D. Baker" <jdbaker@consolidated.net>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/53897: tools/pkg_chk bug with python multi-version pkgs
Date: Mon, 21 Jan 2019 08:45:50 -0600 (CST)

 I have seen this back with pkgsrc-2018Q3.  When python37 appeared,
 packages that could use (or preferred) python-3.x selected the highest
 available and installed python37.  Except for some packages which are
 (still) stuck at python-2.x and simply updated python27.  Then LibreOffice
 requires python-3.x but (still) can't use python37, so began installing
 python36 (again).

 To keep from having to install three versions of python, I set my
 PYTHON_VERSION_DEFAULT=36 which would satisfy all packages except those
 still using python27.

 The subsequent runs of 'pkg_rolling-replace' (which uses 'pkg_chk') would
 report some "py36-foo" packages missing when only the "py27-foo" version
 was installed.  If not excluded with "-Xpy36-foo,py36-bar,...' it would
 try to replace them and fail due to the package missing.

 Likewise, where both "py27-foo" and "py36-foo" packages were installed,
 only the "py36-foo" package would be updated and the "py27-foo" version
 would be ignored.  I would have to manually update those packages with

   $ make PYTHON_VERSION_REQD=27 replace package clean

 and re-run 'pkg_rr' to pick up unsafe dependency changes caused by the
 "py27-foo" updates.

 -- 
 |/"\ John D. Baker, KN5UKS               NetBSD     Darwin/MacOS X
 |\ / jdbaker[snail]consolidated[flyspeck]net  OpenBSD            FreeBSD
 | X  No HTML/proprietary data in email.   BSD just sits there and works!
 |/ \ GPGkeyID:  D703 4A7E 479F 63F8 D3F4  BD99 9572 8F23 E4AD 1645

From: "John D. Baker" <jdbaker@consolidated.net>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/53897: tools/pkg_chk bug with python multi-version pkgs
Date: Mon, 21 Jan 2019 09:26:56 -0600 (CST)

 See threads:

   http://mail-index.netbsd.org/pkgsrc-users/2018/09/15/msg027435.html
   http://mail-index.netbsd.org/pkgsrc-users/2018/09/16/msg027443.html

 -- 
 |/"\ John D. Baker, KN5UKS               NetBSD     Darwin/MacOS X
 |\ / jdbaker[snail]consolidated[flyspeck]net  OpenBSD            FreeBSD
 | X  No HTML/proprietary data in email.   BSD just sits there and works!
 |/ \ GPGkeyID:  D703 4A7E 479F 63F8 D3F4  BD99 9572 8F23 E4AD 1645

From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/53897: tools/pkg_chk bug with python multi-version pkgs
Date: Fri, 25 Jan 2019 09:41:29 +0100

 Noticing that pkg_chk already special-cases py[0-9][0-9]-* in one place,
 I thought maybe it would be OK to add more of this.

 The patch below is incomplete but makes things a bit better for me.
 I must have missed some place where a similar hack is needed.

 With this patch the installed pkg is considered newer than the current
 and ignored - obviously wrong but better than trying to build the wrong
 version.

 How to experiment is simple:

 	make /etc/mk.conf contain PYTHON_VERSION_DEFAULT=37
 	cd math/py-roman
 	make cleandir install PYTHON_VERSION_DEFAULT=27
 	pkg_chk -nr

 Martin


 Index: pkg_chk.sh
 ===================================================================
 RCS file: /cvsroot/pkgsrc/pkgtools/pkg_chk/files/pkg_chk.sh,v
 retrieving revision 1.75
 diff -u -r1.75 pkg_chk.sh
 --- pkg_chk.sh	25 Nov 2018 20:17:26 -0000	1.75
 +++ pkg_chk.sh	25 Jan 2019 08:33:54 -0000
 @@ -119,15 +119,25 @@
  	    # XXX need to handle multiple matching package case
  	    msg_n "$pkgdir - "
  	    pkg=$(echo $PKGNAME | ${SED} 's/-[0-9].*//')
 -	    pkginstalled=$(sh -c "${PKG_INFO} -e $pkg" || true)
 +	    pat=$pkg
 +	    case $pkg in
 +		py[0-9][0-9]-*)
 +			pat=$( echo $pkg | sed 's/^py[0-9][0-9]-/py\*-/' )
 +			;;
 +	    esac
 +	    pkginstalled=$(sh -c "${PKG_INFO} -e $pat" || true)
  	    if [ -z "$pkginstalled" ];then
  		msg_n "$PKGNAME missing"
  		MISSING_TODO="$MISSING_TODO $PKGNAME $pkgdir"
  	    else
  		pkgmatch=$(echo $PKGNAME | ${SED} 's/-\([0-9].*\)/>=\1/')
 +		if [ $pat != $pkg ]; then
 +			pyver=$( echo $pkginstalled | sed 's/^py\([0-9][0-9]\)-.*/\1/' )
 +			pkgmatch=$( echo $pkgmatch | ${SED} 's/^py[0-9][0-9]-/'"py${pyver}-/" )
 +		fi
  		if ! ${PKG_ADMIN} pmatch "$pkgmatch" "$pkginstalled" ; then
  		    INSTALL=
 -		    if [ -n "$pkginstalled" ];then
 +		    if [ -n "$pkginstalled" ]; then
  			msg_n "$pkginstalled < $PKGNAME"
  			MISMATCH_TODO="$MISMATCH_TODO $pkginstalled"
  		    else

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.