tech-pkg archive

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

Re: Time to change defaults for PKG_DBDIR



On Sat, 21 May 2022 at 23:43, Greg Troxel <gdt%lexort.com@localhost> wrote:
>
>
> David Brownlee <abs%absd.org@localhost> writes:
> [... pkg_install warns for non empty /var/db/pkg if PKG_DBDIR not explicitly set to it ...]
>
> I would drop "and non empty" from step 1.  The point as I see it is that
> a new tool (which is all we get to control) should fail with an error if
> it detects an unsafe situation.  If /var/db/pkg exists and PKG_DBDIR is
> something else, that's trouble waiting to happen if an older pkg_install
> is run even once.  I'd rather make people who aren't intending to use
> /var/db/pkg actually remove it, to get the benefit of saving even a tiny
> number of people from ending up in split-brain.
>
> But I favor the change, even if consensus comes down on including the
> "and non empty".  I just think it's better to also error on an empty
> /var/db/pkg.

We have two older pkg_install variants - the original which will just
unconditionally default to /var/db/pkg, and the current compat which
overrides any PKG_DBDIR value if /var/db/pkg is present and PKG_DBDIR
is not.

For the original the presence of an empty /var/db/pkg makes no difference.

For the compat the only case I can see where erroring out on an empty
/var/db/pkg could make a difference is where a new pkg_install is run,
warns, the user to delete /var/db/pkg or set PKG_DBDIR, then at some
point the user entirely deletes PKG_DBDIR and runs the older compat
pkg_install - probably by nuking all of /usr/pkg and running the older
pkg_install pkg_add to add a package. Note: this implies they have
managed to get the initial new pkg_install installed the first time
via a different method which did not trigger any issues.

I'd really prefer to not have to force a new binary package user to
read up about and then manually set PKG_DBDIR in pkg_install.conf when
there are no binary packages on their system, however I don't want to
block this any further, so while I'm listing my preferences in order,
I'm happy as long as something is picked:

These would be new pkg_install behaviour if /var/db/pkg is present,
_empty_, and different from the set/default PKG_DBDIR
a) Try to rmdir/unlink (symlink) it, and continue if successful
b) Ignore it and continue
c) Error out the same as if present and non empty

David


Home | Main Index | Thread Index | Old Index