Subject: Package update disaster
To: None <netbsd-users@netbsd.org>
From: Anand Buddhdev <arb@anand.org>
List: netbsd-users
Date: 10/06/2004 21:59:14
Hi everyone,

This evening, after updating my pkgsrc, I used "lintpkgsrc -i" to find 
out what was out of date on my system. I noticed that I had a slightly 
older version of pth package. So I did:

cd /usr/pkgsrc/devel/pth
make update

Well, to my surprise and horror, this went on to erase my mysql-server 
package installation! My mysql-server package was also old, but I did 
not want to update it just yet. Now, I don't understand why the system 
wanted to update mysql, when I was only interested in updating pth.

Secondly, I think the package build system should at least warn me of 
this unexpected detour, and give me a chance to cancel it. Instead it 
happily went on to remove the old mysql files from the system, and THEN 
build the new version. So, while the new package was being built, there 
were no mysql files around!

And finally, the system assumed that the build of the new package would 
succeed, which it did not. In fact, there seems to be a bug at the 
moment, which causes a build of mysql 4.0.20 to fail. So I started with 
an update of the pth package, which ended up in a failed build of mysql, 
leaving me without mysql on my running system :( I had to re-install 
mysql from a pre-built package from an FTP server.

I must say that my initial excitement about pkgsrc is waning somewhat. 
The pkgsrc guide recommends a user to type "make update" to update 
packages. I think the guide should be more conservative, and teach a 
user to be more cautious, and first type just "make", which will build 
new packages, but not remove anything. And if all the builds and their 
dependencies succeed, then proceed with a "make update".

And anyway, why does "make update" FIRST remove the old package? Would 
it not make sense to first build the new package(s), and if all the 
builds succeed, then to proceed with deleting the old packages and 
replacing them with new ones? That makes for a very small package 
unavailability window.