From ryand@greed.zenspider.com  Mon Feb 25 13:02:37 2002
Return-Path: <ryand@greed.zenspider.com>
Received: from greed.zenspider.com (sense-ryand-4.oz.net [216.39.167.4])
	by hub.freebsd.org (Postfix) with SMTP id 8F62C37B41B
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 25 Feb 2002 13:02:36 -0800 (PST)
Received: (qmail 40723 invoked by uid 1000); 25 Feb 2002 21:02:35 -0000
Message-Id: <20020225210235.40722.qmail@greed.zenspider.com>
Date: 25 Feb 2002 21:02:35 -0000
From: Ryan Davis <ryand-bsd@greed.zenspider.com>
Reply-To: Ryan Davis <ryand-bsd@greed.zenspider.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: portupgrade corrupts the db upon update
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         35319
>Category:       ports
>Synopsis:       portupgrade corrupts the db upon update
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    knu
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Feb 25 13:10:00 PST 2002
>Closed-Date:    Wed Feb 27 06:37:44 JST 2002
>Last-Modified:  Wed Feb 27 06:45:19 JST 2002
>Originator:     Ryan Davis
>Release:        FreeBSD 4.5-RC i386
>Organization:
>Environment:
System: FreeBSD greed.zenspider.com 4.5-RC FreeBSD 4.5-RC #0: Sat Jan 12 16:44:16 PST 2002 root@greed.zenspider.com:/usr/obj/usr/src/sys/GREED.ZENSPIDER.COM i386


	
>Description:

After upgrading portupgrade, it caused a version mismatch w/ the DB
package it is dependent on. This is normally fixed with 'pkgdb -F',
but I got the following:

Stale dependency: portupgrade-20020225.1 -> ruby-bdb1-0.1.5:
[origins_by_categories - not a hash (NilClass)] [Updating the portsdb <format:bdb1_btree> in /usr/ports ... - 6622 port entries found .........1000.........2000.........3000.........4000.........5000.........6000...... ..... done]
origins_by_categories - not a hash (NilClass): Cannot read the portsdb!
database file error
ruby-bdb1-0.1.4_1 (score:93%) ? ([y]es/[n]o/[a]ll) [yes] ^C
Interrupted.

doing 'portsdb -uU' did not help and I got the same error.

>How-To-Repeat:
portupgrade portupgrade
portsdb -uU
pkgdb -F
	
>Fix:
unknown
	


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports->knu 
Responsible-Changed-By: petef 
Responsible-Changed-When: Mon Feb 25 13:40:47 PST 2002 
Responsible-Changed-Why:  
Over to maintainer 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=35319 

From: "Akinori MUSHA" <knu@iDaemons.org>
To: Ryan Davis <ryand-bsd@greed.zenspider.com>
Cc: FreeBSD-gnats-submit@freebsd.org
Subject: Re: ports/35319: portupgrade corrupts the db upon update
Date: Tue, 26 Feb 2002 13:12:42 +0900

 At 25 Feb 2002 21:02:35 -0000,
 Ryan Davis wrote:
 > After upgrading portupgrade, it caused a version mismatch w/ the DB
 > package it is dependent on. This is normally fixed with 'pkgdb -F',
 > but I got the following:
 > 
 > Stale dependency: portupgrade-20020225.1 -> ruby-bdb1-0.1.5:
 > [origins_by_categories - not a hash (NilClass)] [Updating the portsdb <format:bdb1_btree> in /usr/ports ... - 6622 port entries found .........1000.........2000.........3000.........4000.........5000.........6000...... ..... done]
 > origins_by_categories - not a hash (NilClass): Cannot read the portsdb!
 > database file error
 > ruby-bdb1-0.1.4_1 (score:93%) ? ([y]es/[n]o/[a]ll) [yes] ^C
 > Interrupted.
 > 
 > doing 'portsdb -uU' did not help and I got the same error.
 
 Is it reproducible by running the following?
 
 	portsdb -fu
 	ports_glob portupgrade
 
 Given that, what does it say if you apply the following patch?
 
 Index: lib/portsdb.rb
 ===================================================================
 RCS file: /home/cvs/pkgtools/lib/portsdb.rb,v
 retrieving revision 1.61
 diff -u -1 -r1.61 portsdb.rb
 --- lib/portsdb.rb	24 Feb 2002 19:33:24 -0000	1.61
 +++ lib/portsdb.rb	26 Feb 2002 04:04:38 -0000
 @@ -412,3 +412,3 @@
  	s = @db['?' + c]
 -	s.is_a?(String) or raise TypeError, "origins_by_categories - not a hash (#{s.type})"
 +	s.is_a?(String) or raise TypeError, "origins_by_categories[#{c}] - not a string (#{s.type})"
  	@origins_by_categories[c] = s.split
 @@ -549,2 +549,3 @@
  	@db['?' + c] = @origins_by_categories[c].join(' ')
 +	STDERR.print("[#{c}]")
        end
 
 And what do you have in *_CATEGORIES in your pkgtools.conf?
 
 -- 
                      /
                     /__  __            Akinori.org / MUSHA.org
                    / )  )  ) )  /     FreeBSD.org / Ruby-lang.org
 Akinori MUSHA aka / (_ /  ( (__(  @ iDaemons.org / and.or.jp
 
 "Somewhere out of a memory.. of lighted streets on quiet nights.."
State-Changed-From-To: open->closed 
State-Changed-By: knu 
State-Changed-When: Wed Feb 27 06:37:44 JST 2002 
State-Changed-Why:  
Should be fixed in 20020227.  Thanks for the report. 

To cope with the situation, run "portsdb -qu; portupgrade -q portupgrade". 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=35319 
>Unformatted:
