Subject: Re: pkg_create coredumps resulting in empty +CONTENTS
To: Hubert Feyrer <feyrer@cs.stevens.edu>
From: Lars Nordlund <lars.nordlund@hem.utfors.se>
List: tech-pkg
Date: 10/25/2005 09:08:51
On Tue, 25 Oct 2005 02:57:12 +0200 (CEST)
Hubert Feyrer <feyrer@cs.stevens.edu> wrote:

> On Tue, 25 Oct 2005, Lars Nordlund wrote:
> > #0  0xbbbbf10e in memmove () from /usr/lib/libc.so.12
> > #1  0x5ab8afd4 in ?? ()
> > #2  0xbbbb73f0 in __bt_split () from /usr/lib/libc.so.12
> > #3  0xbbbb6bb3 in __bt_split () from /usr/lib/libc.so.12
> > #4  0xbbbb2eaa in __bt_put () from /usr/lib/libc.so.12
> > #5  0x0804dd3a in pkgdb_store (
> >    key=0xbfbfce60 "/usr/pkg/share/examples/openslp/slp.conf",
> >    val=0x805b019 "openslp-1.2.1") at pkgdb.c:126
> 
> Welcome to the wonderful world of db(3) lossage.
> Please use "pkg_admin rebuild" to fix.

Ah, thanks! Perhaps make ${MAKE} stop with an error message if this
happens? Something along these lines:

-               ${PKG_CREATE} ${PKG_ARGS_INSTALL} -O ${PKGFILE} > ${PKG_DB_TMPDIR}/+CONTENTS; \
+               if ! ${PKG_CREATE} ${PKG_ARGS_INSTALL} -O ${PKGFILE} > ${PKG_DB_TMPDIR}/+CONTENTS; then \
+                       ${ECHO} "(pkg_create: exitcode $$?)";           \
+                       ${ECHO} "Please use pkg_admin rebuild to repair the pkgdb"; \
+                       exit 1;                                         \
+               fi;                                                     \

which gives this message if pkg_create coredumps:

/usr/pkg/bin/sudo ===> real-su-install [nawk-20050424] ===> Creating installation directories
/usr/bin/install -c -s -o root -g wheel -m 555 /usr/pkgsrc/lang/nawk/work.glengoyne/a.out /usr/pkg/bin/nawk
/usr/bin/install -c -o root -g wheel -m 444 /usr/pkgsrc/lang/nawk/work.glengoyne/nawk.1 /usr/pkg/man/man1/nawk.1
===> register-pkg [nawk-20050424] ===> Registering installation for nawk-20050424
[1]   Segmentation fault (core dumped) /home/lars/work/...
(pkg_create: exitcode 0)
Please use pkg_admin rebuild to repair the pkgdb
*** Error code 1

Stop.
make: stopped in /usr/pkgsrc/lang/nawk
*** Error code 1


(a bit strange that exitcode is 0 even though the program crashed? I would
have expected 139)


This would have saved me from some trouble later...


Best regards,
	Lars Nordlund