tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pkg_install: move pkgdb under ${PREFIX}

Taylor R Campbell <> writes:

>> Date: Fri, 28 Aug 2020 20:42:42 -0400
>> From: Greg Troxel <>
>>   Logically pkgdb belongs in /var/db, per hier(7), and the problem
>>   with that location is that it is logically connected to /usr/pkg,
>>   but not in it, which leads to trouble.  And it is inconsistent in
>>   netbsd vs bootstrapped pkgsrc.
> I don't see why /var is logical.

Back in the 4.2BSD days when hier(7) arose, /var was for things that
were modified and /usr was something that could be readonly.

/usr/pkg is a prefix that only sort of belongs in /usr, and then within
/usr/pkg there are subdirectories that belong in usr and some that
belong in var.

So this is something that gets written, and thus belongs in something
var-ish.  I agree that it makes sense to have the var-ish dir under
/usr/pkg, and what it is called is not that important.

> Changes to pkgdb essentially always go hand in hand with changes to
> /usr/pkg, for updates to the metadata and data of packages when the
> set of installed packages changes (except for rare operations like
> pkg_admin set automatic=yes).

unsafe_depends is also set that way by pkg_rr, but as you say that
involves changing /usr/pkg anyway.

> Unlike the contrast between /usr and /var, it doesn't make much sense
> to keep one read/write while the other is read-only -- if you're not
> installing or removing packages there's no need to write to either
> /usr/pkg or to pkgdb.

except for automatic, I think that's true.

>>   I don't like hiding it with ., as .pkgdb.  I think that's admitting
>>   that it doesn't belong in /usr/pkg but that we put it there anyway.
>>   (If it does belong, just call it pkgdb.  It's not like "ls -l
>>   /usr/pkg" is often run, and that there is any value in hiding it.
>>   Arguably, hiding it will confuse people more than it helps.)
> It's metadata for the directory tree, like .git or .cvsignore or
> .dir-locals.el -- seems reasonable to me to use `.' for that.

It does not seem terrible, but I think the cost of hiding it, in terms
of people that won't get it that it is there, is greater than the cost
of it appearing for those that do "ls" in /usr/pkg.   In all
seriousness, who does that and how often, and is it a win for those
people to be not told about .pkgdb vs seeing pkgdb?

One system I just checked has 33 subdirectories in /usr/pkg, including 4
gcc versions, 2 go versions, a java and guile directory, qt4 and qt5,
qwt, and a few others from packages (pgsql, unifi).  It's hard for me to
make a case that pkgdb appearing in that ls output is going to bother
people and needs suppressing.

But the hard part is not that; it's dealing with base because people
have 2 copies of pkg_add and friends, and not everyone is 100% about
having /usr/pkg/sbin before /usr/sbin in PATH.

Attachment: signature.asc
Description: PGP signature

Home | Main Index | Thread Index | Old Index