NetBSD Problem Report #54123

From woods@future.weird.com  Sun Apr 14 22:05:20 2019
Return-Path: <woods@future.weird.com>
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 8BF067A177
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 14 Apr 2019 22:05:20 +0000 (UTC)
Message-Id: <20190414220516.DF2375803E@future.weird.com>
Date: Sun, 14 Apr 2019 15:05:16 -0700 (PDT)
From: "Greg A. Woods" <woods@planix.ca>
Reply-To: "Greg A. Woods" <woods@planix.ca>
To: gnats-bugs@NetBSD.org
Subject: crash trying 'pkgin upgrade' with locally built pkg_summary
X-Send-Pr-Version: 3.95

>Number:         54123
>Category:       pkg
>Synopsis:       crash trying 'pkgin upgrade' with locally built pkg_summary
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    jperkin
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Apr 14 22:10:00 +0000 2019
>Last-Modified:  Mon Jun 10 05:30:04 +0000 2019
>Originator:     Greg A. Woods
>Release:        NetBSD 8.99.32
>Organization:
Planix, Inc.; Kelowna, BC; Canada
>Environment:
System: NetBSD future 8.99.32 NetBSD 8.99.32 (XEN3_DOMU) #0: Mon Feb 4 15:01:05 PST 2019 woods@future:/build/woods/future/current-amd64-amd64-obj/building/work/woods/m-NetBSD-current/sys/arch/amd64/compile/XEN3_DOMU amd64
Architecture: x86_64
Machine: amd64
>Description:

	I had done "pkg_info -X -a | gzip > $PKG_PATH/pkg_summary.gz" on
	the build host, then installed pgkin-0.11.7 on a client host
	(which mounts the build host's packages directory via NFS), then
	this happened:

# pkgin update
cleaning database from ftp://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/amd64/8.99.32/All entries...
processing remote summary (file:///future/build/packages/root/NetBSD/8.99.32/x86_64/All/)...
pkg_summary.gz                                                                                    100%   69KB  68.6KB/s   00:00    
# pkgin upgrade
calculating dependencies...done.
warning: package automake-1.15.1nb1 has an empty FILE_SIZE on repository.
warning: package autoconf>=2.62 has an empty FILE_SIZE on repository.
warning: package m4>=1.4 has an empty FILE_SIZE on repository.
warning: package perl>=5.0 has an empty FILE_SIZE on repository.
warning: package libarchive-3.3.3 has an empty FILE_SIZE on repository.
warning: package rsync-3.1.3nb1 has an empty FILE_SIZE on repository.
warning: package osabi-NetBSD-8.99.32 has an empty FILE_SIZE on repository.
warning: package conserver8-8.2.1nb4 has an empty FILE_SIZE on repository.
warning: package py27-curses-2.7.15nb5 has an empty FILE_SIZE on repository.
Memory access violation (core dumped) 

	Here's what I could get from GDB.

Reading symbols from pkgin...(no debugging symbols found)...done.
[New process 1]
Core was generated by `pkgin'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x0000000000697df0 in strlen ()
(gdb) bt
#0  0x0000000000697df0 in strlen ()
#1  0x0000000000687ff2 in strdup ()
#2  0x00000000004092ef in xstrdup ()
#3  0x000000000040547a in order_install ()
#4  0x000000000040388a in pkgin_install ()
#5  0x000000000040435f in pkgin_upgrade ()
#6  0x00000000006b1d85 in main ()
(gdb) file pkgin.debug
warning: exec file is newer than core file.
Reading symbols from pkgin.debug...done.
(gdb) bt
#0  0x0000000000697df0 in strlen ()
#1  0x0000000000687ff2 in _strdup (str=0x0) at /building/work/woods/m-NetBSD-current/lib/libc/string/strdup.c:60
#2  0x0000000000000001 in ?? ()
#3  0x00007c4b5de958f0 in ?? ()
#4  0x0000000000000001 in ?? ()
#5  0x00000000004092ef in xstrdup (str=<optimized out>) at external/xwrapper.c:97
#6  0x0000000000000001 in ?? ()
#7  0x000000000040547a in order_install (impacthead=0x7c4b5de85f98, op=4) at order.c:194
#8  0x0000000000000000 in ?? ()
(gdb) 


(gdb) up
#7  0x000000000040547a in order_install (impacthead=0x7c4b5de85f98, op=4) at order.c:194
194                                     pdp->pkgurl = xstrdup(pimpact->pkgurl);
(gdb) info locals
ordtreehead = 0x7c4b5de85fa8
pimpact = 0x7c4b5de958f0
pdp = <optimized out>
pi_dp = 0x0
i = 1
maxlevel = <optimized out>
tmpcheck = "\220\365A\377\177\177\000\000xenful", '\000' <repeats 250 times>...
(gdb) print pimpact->pkgurl
$2 = 0x0
(gdb) print *pimpact
$3 = {type = 0 '\000', size_pkg = 3165315, old_size_pkg = 3165626, file_size = 0, level = 1, download = 0, pkgurl = 0x0, 
  full = 0x7c4b5de934e0 "autoconf-2.69nb8", name = 0x7c4b5dea4800 "autoconf", old = 0x7c4b5de934c0 "autoconf-2.69nb5", 
  version = 0x0, build_date = 0x7c4b5de934a0 "2019-04-14 13:29:09 -0700", depend = 0x7c4b5dea47f0 "autoconf>=2.62", 
  category = 0x0, pkgpath = 0x0, comment = 0x0, keep = 0, action = 4, next = {sle_next = 0x7c4b5de95860}}


>How-To-Repeat:

>Fix:

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: pkg-manager->jperkin
Responsible-Changed-By: bsiegert@NetBSD.org
Responsible-Changed-When: Mon, 15 Apr 2019 11:55:43 +0000
Responsible-Changed-Why:
Over to maintainer.


From: Jonathan Perkin <jperkin@pkgsrc.org>
To: gnats-bugs@netbsd.org
Cc: pkg-manager@netbsd.org, pkgsrc-bugs@netbsd.org, gnats-admin@netbsd.org,
	bsiegert@NetBSD.org, "Greg A. Woods" <woods@planix.ca>
Subject: Re: pkg/54123 (crash trying 'pkgin upgrade' with locally built
 pkg_summary)
Date: Wed, 17 Apr 2019 23:32:40 +0100

 While pkgin shouldn't crash and should be able to handle bad input, it
 should be pointed out that this use-case is not expected to work at all,
 and any fix will simply enforce that.  Your pkg_summary files should be
 generated from binary package files, not installed packages.

 -- 
 Jonathan Perkin       www.perkin.org.uk
 github.com/jperkin  twitter.com/jperkin

From: David Holland <dholland-pbugs@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/54123 (crash trying 'pkgin upgrade' with locally built
 pkg_summary)
Date: Mon, 10 Jun 2019 05:29:13 +0000

 not sent to gnats (send bug traffic to gnats-bugs, not gnats-admin)

    ------

 From: "Greg A. Woods" <woods@planix.ca>
 To: NetBSD GNATS Administrator <gnats-admin@NetBSD.org>
 Subject: Re: pkg/54123 (crash trying 'pkgin upgrade' with locally built
 	pkg_summary)
 Date: Wed, 17 Apr 2019 21:49:47 -0700

 At Wed, 17 Apr 2019 23:32:40 +0100, Jonathan Perkin <jperkin@pkgsrc.org> wrote:
 Subject: Re: pkg/54123 (crash trying 'pkgin upgrade' with locally built pkg_summary)
 >
 > While pkgin shouldn't crash and should be able to handle bad input, it
 > should be pointed out that this use-case is not expected to work at all,
 > and any fix will simply enforce that.  Your pkg_summary files should be
 > generated from binary package files, not installed packages.

 Hmmm... OK, so how should I generate the pkg_summary file for my limited
 archive of locally built binary packages?

 I couldn't find much info anywhere about handling the server-side of
 things for pkgin, so I RTFM'ed and just did what it says in
 pkg_summary(5):

      The pkg_summary file can be generated using the pkg_info(1) ?X option.
      For example, the following will list this data for all installed pack?
      ages:

            pkg_info ?X ?a

 And I hoped that a file of the same name was of the kind that pkgin
 would be happy to use.

 Pkgin did seem to happily suck up the file, and "pkgin avail" gives me a
 nice list corresponding to all the binary packages I should have
 available.  It's just the attempt to install one of them that failed.

 I.e. there are binaries for all the installed packages in PKG_PATH --
 that's the point, after all, as I am trying to use pkgin to install
 those binaries on other local systems.  (Indeed I now rely on the way
 pkgsrc uses DESTDIR to create a binary package that's then installed as
 the last step, even on the build machine.)

 (and yes, PKG_PATH is set when I run "pkg_info -X -a", if that matters)

 One caveat I have locally is that these binary packages may not all for
 the same OS version and/or they may not all be in the same PKG_PATH
 location, since it is -current, and I've built different packages at
 different times while upgrading the OS from time to time (and though I
 often use pgk_rolling-replace with its '-B' option on the build machine,
 that doesn't seem to find absolutely everything that's not for the same
 OS version and rebuild it).

 So, I'm not sure if I should be simply linking together all the
 compatible OS version binary package directories, or not.  With pkg_add
 I can't put multiple repositories in PKG_PATH, and presumably not for
 "pkg_info -X" either, though it is hinted that repositories.conf can
 contain a list of locations, though it's not clear if there can only be
 one per $arch and/or $osrelease, nor is it clear what happens if
 different installed packages were built for different (but nominally
 compatible) $osrelease values.  (The issue for me is that I'll likely
 never manage to build everything I want all together at once with the
 exact same OS release -- and I don't want to care about this as long as
 the installed binaries run, and after all that's part of the point of
 using NetBSD is that the ABI is stable for the most part, and even if
 I've built packages on an old release that needs a COMPAT option, I
 might want to include them in the stable of binary packages that I make
 available for pkgin.  I only really want to use pkgin for its ease of
 managing upgrades, since for the initial installs it is not much
 different for me to just use pkg_add directly, provided I really can
 start with an empty /var/db/pkgin database and have it rebuilt to
 account for such manually installed packages.)

 --
 					Greg A. Woods <gwoods@acm.org>

 +1 250 762-7675                           RoboHack <woods@robohack.ca>
 Planix, Inc. <woods@planix.com>     Avoncote Farms <woods@avoncote.ca>

>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.