Subject: Re: Changes to reference count directories
To: Hubert Feyrer <hubert@feyrer.de>
From: Johnny C. Lam <jlam@NetBSD.org>
List: tech-pkg
Date: 01/26/2005 10:07:52
On Wed, Jan 26, 2005 at 10:20:37AM +0100, Hubert Feyrer wrote:
> On Wed, 26 Jan 2005, Johnny C. Lam wrote:
> >Reference count directories so that we know when it's safe to remove
> >a directory without impacting the remaining packages. The reference
> >counts are stored in /var/db/pkgdir. The install scripts are also
> >extended to allow for easy sanity-checking and fixing of the directories
> >present in the filesystem.
>
> I didn't understand the problem you're trying to solve here. Can you
> please explain it?
Suppose you had several packages that require a certain directory to
exist in order to function properly. For example, suppose you have
several versions of openssh installed via pkgsrc (this is possible
with pkgviews), or even the case where you have an openssh in the base
system as well as an pkgsrc openssh installed. Each openssh instance
requires /var/chroot/sshd to exist. When one of the openssh packages
is removed, it should leave behind the /var/chroot/sshd directory
because there are other packages that still use it. This is exactly
the type of problem that reference-counting solves.
Once you decide to use reference-counting, there are two places to
keep the reference counts: attached to the directory that is being
ref-counted, or kept somewhere separate from the directories. I
decided to keep the ref-counts in a single location so that there
aren't meta-data files scattered across the filesystem. This should
incidentally fix pkg/21511.
There are two main benefits to the new implementation. There now
exists a script (+DIRS) that can be run at any time to create any
missing directories. Also, the install scripts are more factored, so
they're easier to understand and edit.
> My question is if and how this affects binary packages (pkg_add), esp.
> ones that are installed via FTP.
No, this has no discernable effect on binary packages. Everything is
still being driven by the INSTALL/DEINSTALL scripts, so no updates of
pkg_* tools are necessary. Packages built before and after this change
can be freely mixed, although only the new packages will have the
benefit of the reference counting. There is no simple way to modify
existing packages to use reference counting, so just being able to
mix old and new packages will be the best I can do.
Cheers,
-- Johnny Lam <jlam@NetBSD.org>