broken INDEX? ruby segfaults when updating the pkgdb

Fernan Aguero fernan at
Mon Jan 10 09:00:10 PST 2005


I'm experiencing these kind of errors since a few days ago:

[Updating the pkgdb <format:bdb1_btree> in /var/db/pkg ... -
671 packages found (-5 +3) (...)[Updating the pkgdb
<format:bdb1_btree> in /var/db/pkg ... - 671 packages found
(-5 +3) (...)/usr/local/lib/ruby/site_ruby/1.8/pkgdb.rb:467:
[BUG] Segmentation fault
ruby 1.8.2 (2004-12-25) [i386-freebsd4]

Abort (core dumped)

I already read ports/UPDATING and tested a few things, but
nothing seems to fix it. Please note also that I've been
running RELENG_4_10 for some time and that I've never
experienced this problem before (the entry in UPDATING is
from November 2004).

This is what I did to try to fix the problem:

i) pkg_delete ruby, ruby-bdb1 and portupgrade; and then
reinstall portupgrade manually (this installed fresh ruby
and ruby-bdb1 as dependencies). The problem persists.

ii) added ENV['PORTS_DBDRIVER'] = 'dbm_hash' to
pkgtools.conf. The problem persists.

iii) Tried to set PORTS_DBDRIVER in my shell to either
dbm_hash or to bdb1_hash, as suggested in UPDATING.
The problem persists.

However, if I retrieve a new INDEX file, the error
temporarily changes:

1) make fetchindex
2) portsdb -u
3) pkgdb -F

--->  Checking the package registry database
[Updating the pkgdb <format:bdb1_btree> in /var/db/pkg ... - 671 packages found (-5 +3) (...)/usr/local/lib/ruby/site_ruby/1.8/pkgdb.rb:467:in `select': failed to allocate memory (NoMemoryError)
        from /usr/local/lib/ruby/site_ruby/1.8/pkgdb.rb:467:in `update_db'
        from /usr/local/lib/ruby/site_ruby/1.8/pkgdb.rb:592:in `open_db'
        from /usr/local/lib/ruby/site_ruby/1.8/pkgdb.rb:759:in `installed_pkgs'
        from /usr/local/sbin/pkgdb:292:in `fix_db_init'
        from /usr/local/sbin/pkgdb:284:in `fix_db'
        from /usr/local/sbin/pkgdb:231:in `main'
        from /usr/local/sbin/pkgdb:64:in `initialize'
        from /usr/local/sbin/pkgdb:64:in `new'
        from /usr/local/sbin/pkgdb:64:in `main'
        from /usr/local/sbin/pkgdb:1043

After this run, then all subsequent runs produce the
segfault error reported first.

I am running FreeBSD-4.10-p5 (RELENG_4_10) and I always do a
'cd /usr/ports && make fetchindex' after cvsuping my ports

Now my questions:

is it possible, as suggested in the followups to PR
ports/71558, that this could be caused by a malformed INDEX

I know that there are checks to detect INDEX breakage but
correct me if I'm wrong, these only check for breaks at the
'make index' level. As suggested in the PR, perhaps the
INDEX looks OK, but in some subtle way it is causing some
problem(s) to portsdb.rb at parse time.

I am now trying to generate INDEX instead of downloading
one, but it is taking a while.  Once I test with my
self-generated INDEX, I will report back (according to the
followup to ports/71558 posted by Nick Christenson, manually
generating the index makes the problem go away.)

The mentioned PR is still open ... are the portupgrade
authors aware of this issues? Perhaps this is only evident
for 4.x?

Thanks in advance for any tip or suggestion,


PS: is it safe to rm pkgdb.db in /var/db/pkg and run pkgdb

More information about the freebsd-ports mailing list