Subject: pkg_* crashes
To: None <>
From: Marc Baudoin <>
List: tech-pkg
Date: 03/15/2005 17:29:13

I've been experiencing problems with pkgsrc (kept up to date) on
a NetBSD 2.0 system (only one, the other ones I manage are fine).

It began when I wanted to upgrade x11/randrext.  make update
failed because it couldn't delete some files.  Having no time to
investigate, I deleted them by hand and did a pkg_delete -O.
Installing a new randrext then failed:

roquefort:/usr/pkgsrc/x11/randrext> make install
===> Installing for randrext-1.0nb1
===> Becoming to install randrext.
/usr/pkg/bin/sudo /bin/sh ./mkinstalldirs /usr/pkg/lib/pkgconfig
 install -c -o root -g wheel -m 444 randr.pc /usr/pkg/lib/pkgconfig/randr.pc
/bin/sh ./mkinstalldirs /usr/pkg/share/doc/randrext
 install -c -o root -g wheel -m 444 protocol /usr/pkg/share/doc/randrext/protocol
/bin/sh ./mkinstalldirs /usr/pkg/include/X11/extensions
 install -c -o root -g wheel -m 444 randr.h /usr/pkg/include/X11/extensions/randr.h
 install -c -o root -g wheel -m 444 randrproto.h /usr/pkg/include/X11/extensions/randrproto.h
===> Registering installation for randrext-1.0nb1
[1]   Segmentation fault      /usr/sbin/pkg_cr...

In particular, the +CONTENTS file is empty:

roquefort:/usr/pkgsrc/x11/randrext> ll /var/db/pkg/randrext-1.0nb1 
total 7
-rw-r--r--  1 root  wheel  1614 Mar 15 16:22 +BUILD_INFO
-rw-r--r--  1 root  wheel   483 Mar 15 16:22 +BUILD_VERSION
-rw-r--r--  1 root  wheel    52 Mar 15 16:22 +COMMENT
-rw-r--r--  1 root  wheel     0 Mar 15 16:22 +CONTENTS
-rw-r--r--  1 root  wheel   169 Mar 15 16:22 +DESC
-rw-r--r--  1 root  wheel     6 Mar 15 16:22 +SIZE_ALL
-rw-r--r--  1 root  wheel     6 Mar 15 16:22 +SIZE_PKG

(looks like the +CONTENTS file is the only one affected).

Of course, pkg_delete won't work beacuse +CONTENTS is empty and
I'm stuck with manual deletion.

Moreover, x11/Xrandr and x11/openmotif now show the same

Installing a binary package constructed on a clean system doesn't

roquefort:/tmp> sudo pkg_add randrext-1.0nb1.tgz 
zsh: segmentation fault  sudo pkg_add randrext-1.0nb1.tgz

So I'm stuck.  I wonder if my /var/db/pkg/pkgdb.byfile.db file is
corrupted.  How can I check (and possibly repair) this?

Any other idea?