NetBSD Problem Report #45203

From moritz@wzff.de  Tue Aug  2 00:21:11 2011
Return-Path: <moritz@wzff.de>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id 1EBB763CBEB
	for <gnats-bugs@gnats.NetBSD.org>; Tue,  2 Aug 2011 00:21:11 +0000 (UTC)
Message-Id: <E1Qo2jI-000411-2n@barfooze.de>
Date: Tue, 02 Aug 2011 02:21:04 +0200
From: moritz@wzff.de
Reply-To: moritz@wzff.de
To: gnats-bugs@gnats.NetBSD.org
Subject: pkg_delete segfaults with (apparently) previously partially deleted package
X-Send-Pr-Version: 3.95


>Number:         45203
>Category:       pkg
>Synopsis:       pkg_delete segfaults with (apparently) previously partially deleted package
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    agc
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Aug 02 00:25:01 +0000 2011
>Last-Modified:  Tue Aug 09 23:30:03 +0000 2011
>Originator:     Moritz Wilhelmy
>Release:        NetBSD 5.99.54
>Organization:
>Environment:
System: NetBSD fenrir 5.99.54 NetBSD 5.99.54 (GENERIC) #2: Mon Jul 18 18:56:29 CEST 2011 root@fenrir:/usr/obj/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386


$ /usr/pkg/sbin/pkg_delete -V
20110215
$ /usr/sbin/pkg_delete -V
20110215




/usr/sbin/pkg_delete:
     $NetBSD: crt0-common.c,v 1.7 2011/06/30 20:07:35 matt Exp $
     $NetBSD: crt0.S,v 1.3 2011/07/01 02:59:05 joerg Exp $
     $NetBSD: crti.S,v 1.1 2010/08/07 18:01:33 joerg Exp $
     $NetBSD: crtbegin.S,v 1.1 2010/08/07 18:01:33 joerg Exp $
     $NetBSD: pkg_delete.c,v 1.1.1.7 2010/02/03 14:23:46 joerg Exp $
     $NetBSD: version.c,v 1.1.1.3 2010/02/03 14:24:00 joerg Exp $
     $NetBSD: str.c,v 1.1.1.2 2009/02/02 20:44:08 joerg Exp $
     $NetBSD: remove.c,v 1.1.1.2 2009/08/06 16:55:29 joerg Exp $
     $NetBSD: parse-config.c,v 1.1.1.11 2010/06/26 00:14:31 joerg Exp $
     $NetBSD: global.c,v 1.1.1.2 2009/02/02 20:44:06 joerg Exp $
     $NetBSD: fexec.c,v 1.1.1.3 2009/08/06 16:55:26 joerg Exp $
     $NetBSD: automatic.c,v 1.1.1.2 2009/02/02 20:44:05 joerg Exp $
     $NetBSD: var.c,v 1.1.1.3 2009/08/06 16:55:29 joerg Exp $
     $NetBSD: plist.c,v 1.1.1.5 2009/08/06 16:55:28 joerg Exp $
     $NetBSD: file.c,v 1.1.1.6 2011/02/18 22:32:30 aymeric Exp $
     $NetBSD: pkgdb.c,v 1.1.1.8 2010/04/23 20:54:11 joerg Exp $
     $NetBSD: opattern.c,v 1.1.1.2 2009/02/02 20:44:06 joerg Exp $
     $NetBSD: xwrapper.c,v 1.1.1.1 2009/02/02 20:44:09 joerg Exp $
     $NetBSD: crtend.S,v 1.1 2010/08/07 18:01:33 joerg Exp $
     $NetBSD: crtn.S,v 1.1 2010/08/07 18:01:34 joerg Exp $


/usr/pkg/sbin/pkg_delete:
     $NetBSD: crt0-common.c,v 1.7 2011/06/30 20:07:35 matt Exp $
     $NetBSD: crt0.S,v 1.3 2011/07/01 02:59:05 joerg Exp $
     $NetBSD: crti.S,v 1.1 2010/08/07 18:01:33 joerg Exp $
     $NetBSD: crtbegin.S,v 1.1 2010/08/07 18:01:33 joerg Exp $
     $NetBSD: pkg_delete.c,v 1.11 2010/02/03 14:20:14 joerg Exp $
     $NetBSD: automatic.c,v 1.5 2009/02/02 12:35:01 joerg Exp $
     $NetBSD: fexec.c,v 1.12 2009/08/02 17:56:45 joerg Exp $
     $NetBSD: file.c,v 1.30 2010/09/15 13:18:02 joerg Exp $
     $NetBSD: global.c,v 1.5 2009/02/02 12:35:01 joerg Exp $
     $NetBSD: opattern.c,v 1.5 2009/02/02 12:35:01 joerg Exp $
     $NetBSD: parse-config.c,v 1.15 2010/06/16 23:02:49 joerg Exp $
     $NetBSD: pkgdb.c,v 1.39 2010/04/20 21:22:38 joerg Exp $
     $NetBSD: plist.c,v 1.29 2009/08/02 17:56:45 joerg Exp $
     $NetBSD: remove.c,v 1.3 2009/08/02 17:56:45 joerg Exp $
     $NetBSD: str.c,v 1.26 2009/02/02 12:35:01 joerg Exp $
     $NetBSD: var.c,v 1.8 2009/08/02 17:56:45 joerg Exp $
     $NetBSD: version.c,v 1.7 2010/02/03 14:20:14 joerg Exp $
     $NetBSD: xwrapper.c,v 1.2 2009/02/02 12:35:01 joerg Exp $
     $NetBSD: db.c,v 1.3 2010/01/24 12:29:48 obache Exp $
     $NetBSD: hash.c,v 1.3 2010/04/20 00:32:23 joerg Exp $
     $NetBSD: hash_bigkey.c,v 1.1 2008/10/10 00:21:43 joerg Exp $
     $NetBSD: hash_buf.c,v 1.1 2008/10/10 00:21:43 joerg Exp $
     $NetBSD: hash_func.c,v 1.1 2008/10/10 00:21:43 joerg Exp $
     $NetBSD: hash_log2.c,v 1.1 2008/10/10 00:21:43 joerg Exp $
     $NetBSD: hash_page.c,v 1.6 2010/04/20 00:32:23 joerg Exp $
     $NetBSD: rec_open.c,v 1.2 2009/07/16 18:23:32 abs Exp $
     $NetBSD: rec_put.c,v 1.1 2008/10/10 00:21:44 joerg Exp $
     $NetBSD: rec_search.c,v 1.1 2008/10/10 00:21:44 joerg Exp $
     $NetBSD: rec_seq.c,v 1.1 2008/10/10 00:21:44 joerg Exp $
     $NetBSD: rec_utils.c,v 1.1 2008/10/10 00:21:44 joerg Exp $
     $NetBSD: bt_close.c,v 1.1 2008/10/10 00:21:43 joerg Exp $
     $NetBSD: bt_open.c,v 1.5 2009/05/07 00:23:45 schmonz Exp $
     $NetBSD: bt_overflow.c,v 1.1 2008/10/10 00:21:43 joerg Exp $
     $NetBSD: bt_page.c,v 1.1 2008/10/10 00:21:43 joerg Exp $
     $NetBSD: bt_put.c,v 1.1 2008/10/10 00:21:43 joerg Exp $
     $NetBSD: bt_search.c,v 1.1 2008/10/10 00:21:43 joerg Exp $
     $NetBSD: bt_seq.c,v 1.1 2008/10/10 00:21:43 joerg Exp $
     $NetBSD: bt_split.c,v 1.1 2008/10/10 00:21:43 joerg Exp $
     $NetBSD: bt_utils.c,v 1.1 2008/10/10 00:21:43 joerg Exp $
     $NetBSD: mpool.c,v 1.5 2010/04/20 00:32:23 joerg Exp $
     $NetBSD: rec_close.c,v 1.1 2008/10/10 00:21:44 joerg Exp $
     $NetBSD: rec_delete.c,v 1.1 2008/10/10 00:21:44 joerg Exp $
     $NetBSD: rec_get.c,v 1.1 2008/10/10 00:21:44 joerg Exp $
     $NetBSD: bt_conv.c,v 1.1 2008/10/10 00:21:43 joerg Exp $
     $NetBSD: bt_delete.c,v 1.1 2008/10/10 00:21:43 joerg Exp $
     $NetBSD: bt_get.c,v 1.1 2008/10/10 00:21:43 joerg Exp $
     $NetBSD: crtend.S,v 1.1 2010/08/07 18:01:33 joerg Exp $
     $NetBSD: crtn.S,v 1.1 2010/08/07 18:01:34 joerg Exp $


Full backtrace of the pkg_delete from pkgtools/pkg_install, which was built
with debugging information in order to send-pr this:


(gdb) bt full
#0  0x08066cad in __bt_search (t=0xbb908800, key=0xbfbfe24c, exactp=0xbfbfe1d4)
    at /usr/pkgsrc/pkgtools/pkg_install/work/libnbcompat/db/btree/bt_search.c:129
	h = (PAGE *) 0xbb98901c
	base = 50
	idx = 49
	lim = 0
	pg = 438
	cmp = 6
#1  0x0806c482 in __bt_bdelete (t=0xbb908800, key=0xbfbfe24c)
    at /usr/pkgsrc/pkgtools/pkg_install/work/libnbcompat/db/btree/bt_delete.c:296
	e = (EPG *) 0xbfbfe1f8
	h = (PAGE *) 0xbbb5865b
	deleted = 0
	exact = 134670216
	redo = 134684368
#2  0x0806bd51 in __bt_delete (dbp=0xbb94dd00, key=0xbfbfe24c, flags=0)
    at /usr/pkgsrc/pkgtools/pkg_install/work/libnbcompat/db/btree/bt_delete.c:87
	t = (BTREE *) 0xbb908800
	c = (CURSOR *) 0x1df0
	h = (PAGE *) 0xbbbac4e0
	status = 1
#3  0x0804eea7 in pkgdb_remove (key=0xbfbfe6cc "/usr/pkg/share/gtk-doc/html/gtk/AbstractObjects.html")
    at pkgdb.c:238
	keyd = {data = 0xbfbfe6cc, size = 53}
#4  0x08050512 in delete_package (ign_err=0, pkg=0xbfbfeb24, NoDeleteFiles=0, destdir=0x0) at plist.c:675
	restored = 0
	p = (plist_t *) 0xbb9330e0
	last_file = 0xbb932910 "share/gtk-doc/html/gtk/AbstractObjects.html"
	fail = 0
	preserve = 0
	tmp = "/usr/pkg/share/gtk-doc/html/gtk/AbstractObjects.html\000\000teraction.html\000l\0002\000til.html", '\0' <repeats 131 times>, "tñ¿»Ä®ª»÷O¿»¾\204«»¾\204«»", '\0' <repeats 12 times>, "Ék¬»T͹»\030è¿¿\0044³»Ä6\a\b¿\204«»tñ¿»\000¡\221»ð\000\220»Ä6\a\b\0008\a\b¾\204«»Ä6\a\b ó\224»X7\a\b\000ð\224»tñ¿»T\000«»TO¿»\000\017«"...
	prefix = 0xbb901090 "/usr/pkg"
	name = 0xbb9010b0 "gtk2+-2.24.3"
#5  0x0804c1ca in remove_pkg (pkg=0xbb901080 "gtk2+-2.24.3") at pkg_delete.c:697
	fp = (FILE *) 0xbbba7fe0
	fname = 0xbb94f3a0 "/usr/pkg/lib/gtk-2.0/immodules"
	pkgdir = 0x14 <Address 0x14 out of bounds>
	plist = {head = 0xbb904080, tail = 0xbb94f380}
	p = (plist_t *) 0xbb904080
	is_depoted_pkg = 134682012
	rv = -1077936144
	late_error = 0
#6  0x0804c7e5 in main (argc=0, argv=0xbfbfec00) at pkg_delete.c:914
	lpp = (lpkg_t *) 0xbb901070
	pkgs = {tqh_first = 0x0, tqh_last = 0xbfbfeb84}
	sorted_pkgs = {tqh_first = 0x0, tqh_last = 0xbfbfeb7c}
	ch = -1
	r = 1
	has_error = 0
	bad_count = 0


	The file /usr/pkg/share/gtk-doc/html/gtk/AbstractObjects.html is
	not present on my system, it might have been removed earlier.


>Description:
	I'm no expert in debugging things, sorry..

	
	I don't know exactly what happened, but I think this happened after the
	package had been partially removed, which iirc had failed, although
	this is sheer speculation.
	Please let me know whether you need additional information/files and
	SSH access if you think it helps.
	The package I tried to delete was gtk+2 in an attempt to perform an
	update.
>How-To-Repeat:
	If I knew exactly how I did this...
>Fix:

	


>Release-Note:


>Audit-Trail:


Responsible-Changed-From-To: pkg-manager->agc
Responsible-Changed-By: wiz@NetBSD.org
Responsible-Changed-When: Thu, 04 Aug 2011 23:38:37 +0000
Responsible-Changed-Why:
Over to maintainer.




From: Joerg Sonnenberger <joerg@britannica.bec.de>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/45203: pkg_delete segfaults with (apparently) previously
 partially deleted package
Date: Fri, 5 Aug 2011 02:54:53 +0200


 This sounds like the classic corrupted bdb file issue. There are some
 band aids in various parts in place to reduce the chance of crashing,
 but they are not perfect. Try running "pkg_admin rebuild" first.

 
 Joerg

 
From: Moritz Wilhelmy <moritz@wzff.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/45203: pkg_delete segfaults with (apparently) previously
 partially deleted package
Date: Wed, 10 Aug 2011 00:39:07 +0200


 On Fri, Aug 05, 2011 at 01:00:08 +0000, Joerg Sonnenberger wrote:
 > This sounds like the classic corrupted bdb file issue. There are some
 > band aids in various parts in place to reduce the chance of crashing,
 > but they are not perfect. Try running "pkg_admin rebuild" first.

 
 pkg_admin rebuild did the trick, but it shouldn't segfault, no?

 
 	Moritz

 
From: David Holland <dholland-pbugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/45203: pkg_delete segfaults with (apparently) previously
 partially deleted package
Date: Tue, 9 Aug 2011 23:25:59 +0000


 On Tue, Aug 09, 2011 at 10:40:05PM +0000, Moritz Wilhelmy wrote:
  >  On Fri, Aug 05, 2011 at 01:00:08 +0000, Joerg Sonnenberger wrote:
  >  > This sounds like the classic corrupted bdb file issue. There are some
  >  > band aids in various parts in place to reduce the chance of crashing,
  >  > but they are not perfect. Try running "pkg_admin rebuild" first.
  >  
  >  pkg_admin rebuild did the trick, but it shouldn't segfault, no?

 
 No, it shouldn't. (Nor should the files get corrupted, either, but
 with db-1.85 there are some effectively unfixable ways for that to
 happen.)

 
 -- 
 David A. Holland
 dholland@netbsd.org

 
>Unformatted:

 



NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.36 2007/11/24 03:27:39 kano Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.