Subject: Re: Stopping a common shoot-your-own-foot problem
To: Todd Vierling <tv@duh.org>
From: Johnny C. Lam <jlam@NetBSD.org>
List: tech-pkg
Date: 03/29/2005 18:35:57
Todd Vierling wrote:
> On Tue, 29 Mar 2005, Johnny Lam wrote:
> 
> 
>>I'm considering adding a DEINSTALL script to databases/db{,3,4} that would
>>prevent deinstallation of the package unless some condition is met, e.g. a
>>shell environment variable is set.  Basically, I'm picturing something like
>>this:
> 
> 
>>If you are updating to a newer version of db4, please make sure
>>that you have already used the db4_* tools to dump your existing
>>Berkeley DB 4.x databases as the newer version of db4 will not be
>>able to read the existing databases without reloading them.
> 
> 
> Oh, that's Lame.  Most folks won't even know where they are using db4
> databases, as a lot of such databases are under the covers of complex
> applications.

I completely agree with you here.  This is why I suspected I may have to 
push this type of script into the packages that use db4 instead, e.g. 
cyrus-sasl2 (/usr/pkg/etc/sasldb), postfix (hash: maptype), cyrus-imapd 
(/var/imap and /var/spool/imap mailboxes), etc.

> I'd consider this worthy of a bug (not feature request) report to Sleepycat.
> Unlike a SQL database, which is typically quite centralized and easy to dump
> as a whole, Berkeley DB databases can be literally anywhere on the
> filesystem.
> 
> I knew there was a reason I preferred to keep using db1 wherever possible.

Yes, my current pkgsrc DB-related settings in /etc/mk.conf are:

	BDB_DEFAULT=	db4
	BDB185_DEFAULT=	db1

and I've removed "db4" from PKG_DEFAULT_OPTIONS.  This ensures that 
packages that simply include bdb.buildlink3.mk will use the built-in db1 
routines in libc on NetBSD unless we really want something more than 
DB-1.85 compatibility.  In case anyone was wondering, these settings are 
actually pkgsrc defaults, but I've made them explicit in my /etc/mk.conf 
to prevent future changes from impacting me in this regard.

We can complain all we want to Sleepycat, but I seriously doubt that 
they will do anything about this.  So, we're still in the same boat as 
before -- do we want to try to prevent users from shooting their own 
feet, or do we trust that users are smart enough to be careful about 
updating packages?  I used to believe in the latter, but I'm shading 
toward the former now, given the realization that I completely avoid 
using db4 whenever possible solely because I've been burned by updating 
db4 in the past one too many times.

	Cheers,

	-- Johnny Lam <jlam@NetBSD.org>