NetBSD Problem Report #38166

From dholland@eecs.harvard.edu  Tue Mar  4 19:36:17 2008
Return-Path: <dholland@eecs.harvard.edu>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id 3336663B863
	for <gnats-bugs@gnats.NetBSD.org>; Tue,  4 Mar 2008 19:36:17 +0000 (UTC)
Message-Id: <20080304193517.0D499F8CC@tanaqui.eecs.harvard.edu>
Date: Tue,  4 Mar 2008 14:35:16 -0500 (EST)
From: dholland@eecs.harvard.edu
Reply-To: dholland@eecs.harvard.edu
To: gnats-bugs@gnats.NetBSD.org
Subject: crash in pkg_info
X-Send-Pr-Version: 3.95

>Number:         38166
>Category:       pkg
>Synopsis:       crash in pkg_info
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    joerg
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Mar 04 19:40:00 +0000 2008
>Closed-Date:    Wed May 21 22:19:44 +0000 2008
>Last-Modified:  Wed May 21 22:19:44 +0000 2008
>Originator:     David A. Holland <dholland@eecs.harvard.edu>
>Release:        NetBSD 4.99.54 (pkg_install 20080223)
>Organization:
>Environment:
System: NetBSD tanaqui 4.99.54 NetBSD 4.99.54 (TANAQUI) #21: Fri Feb 29 12:31:31 EST 2008 dholland@tanaqui:/usr/src/sys/arch/i386/compile/TANAQUI i386
Architecture: i386
Machine: i386
>Description:

	Owing to some assorted lossage I ended up the other day with a
	package directory in /var/db/pkg that contained nothing but a
	core file.

	This arrangement of things causes pkg_info to dump core.

	(Which, if the nightly pkg_info run is enabled, causes a lot
	of muck in the results that needs to be waded through.)

>How-To-Repeat:

	mkdir /var/db/pkg/plonk-1.0
	pkg_info

>Fix:

Index: files/info/perform.c
===================================================================
RCS file: /cvsroot/pkgsrc/pkgtools/pkg_install/files/info/perform.c,v
retrieving revision 1.44
diff -u -r1.44 perform.c
--- files/info/perform.c	22 Feb 2008 21:58:16 -0000	1.44
+++ files/info/perform.c	4 Mar 2008 19:28:48 -0000
@@ -390,7 +390,8 @@
 		char    tmp[MaxPathSize];

 		(void) snprintf(tmp, sizeof(tmp), "%-19s ", pkg);
-		show_index(meta->meta_comment, tmp);
+		show_index(meta->meta_comment ? meta->meta_comment : "???",
+			tmp);
 	} else if (Flags & SHOW_BI_VAR) {
 		if (strcspn(BuildInfoVariable, "ABCDEFGHIJKLMNOPQRSTUVWXYZ")
 		    == strlen(BuildInfoVariable))

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: pkg-manager->joerg
Responsible-Changed-By: tnn@NetBSD.org
Responsible-Changed-When: Tue, 04 Mar 2008 20:52:24 +0000
Responsible-Changed-Why:
Over to maintainer.


From: Joerg Sonnenberger <joerg@britannica.bec.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/38166: crash in pkg_info
Date: Wed, 5 Mar 2008 15:04:41 +0100

 --Kj7319i9nmIyA2yE
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline

 On Tue, Mar 04, 2008 at 07:40:00PM +0000, dholland@eecs.harvard.edu wrote:
 > 	Owing to some assorted lossage I ended up the other day with a
 > 	package directory in /var/db/pkg that contained nothing but a
 > 	core file.

 Can you try the attached patch instead? It should apply to pkgsrc as
 well.

 Joerg

 --Kj7319i9nmIyA2yE
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="perform.c.diff"

 Index: perform.c
 ===================================================================
 RCS file: /data/repo/netbsd/src/dist/pkg_install/info/perform.c,v
 retrieving revision 1.1.1.7
 diff -u -p -r1.1.1.7 perform.c
 --- perform.c	22 Feb 2008 22:16:37 -0000	1.1.1.7
 +++ perform.c	5 Mar 2008 13:57:54 -0000
 @@ -278,7 +278,7 @@ read_meta_data_from_pkgdb(const char *pk
  		fd = open(fname, O_RDONLY, 0);
  		free(fname);
  		if (fd == -1) {
 -			if (errno == ENOENT)
 +			if (errno == ENOENT && descr->required_file == 0)
  				continue;
  			err(2, "cannot read meta data file %s",
  			    descr->entry_filename);

 --Kj7319i9nmIyA2yE--

From: David Holland <dholland@eecs.harvard.edu>
To: gnats-bugs@NetBSD.org
Cc: joerg@NetBSD.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org,
	dholland@eecs.harvard.edu
Subject: Re: pkg/38166: crash in pkg_info
Date: Wed, 5 Mar 2008 15:53:34 -0500

 On Wed, Mar 05, 2008 at 02:10:03PM +0000, Joerg Sonnenberger wrote:
  > > 	Owing to some assorted lossage I ended up the other day with a
  > > 	package directory in /var/db/pkg that contained nothing but a
  > > 	core file.
  >  
  >  Can you try the attached patch instead? It should apply to pkgsrc as
  >  well.

 With that I get

 	  :
 	esound-0.2.38       The Enlightened sound daemon
 	seamonkey-gtk1-1.1.8 Full featured gecko-based browser built with GTK1
 	pkg_info: cannot read meta data file +COMMENT: No such file or
 	directory
 	Exit 2
 	# 

 which is not entirely desirable in the context of the nightly pkg_info
 run, since it's going to cause /etc/security's diffing to think that
 half the packages on the system have been removed.

 (Also it doesn't say which package is broken.)



  . o O ( Why do I have esound installed? Maybe that's the problem. )

 -- 
    - David A. Holland / dholland@eecs.harvard.edu

From: Joerg Sonnenberger <joerg@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/38166 CVS commit: pkgsrc/pkgtools/pkg_install/files
Date: Sun,  9 Mar 2008 18:03:46 +0000 (UTC)

 Module Name:	pkgsrc
 Committed By:	joerg
 Date:		Sun Mar  9 18:03:46 UTC 2008

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

 Log Message:
 pkg_install-20080309:
 - When loading meta data for a package and a file is needed for the
   current operation and is a required file, complain.
 - Include the name of the package the meta data could not be loaded
   from.

 This addresses PR 38166.


 To generate a diff of this commit:
 cvs rdiff -r1.44 -r1.45 pkgsrc/pkgtools/pkg_install/files/info/perform.c
 cvs rdiff -r1.94 -r1.95 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.

State-Changed-From-To: open->closed
State-Changed-By: joerg@NetBSD.org
State-Changed-When: Wed, 21 May 2008 22:19:44 +0000
State-Changed-Why:
I think this is addressed.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.