tech-pkg archive

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

Re: pkgdb



On Tue, Dec 15, 2020 at 02:38:31PM +0100, Joerg Sonnenberger wrote:
> On Tue, Dec 15, 2020 at 12:47:39PM +0000, maya%NetBSD.org@localhost wrote:
> > > @@ -303,8 +300,21 @@ pkgdb_refcount_dir(void)
> > >  const char *
> > >  pkgdb_get_dir(void)
> > >  {
> > > +	/* Except for the return at this end, this code is for
> > > +	   migration from the previous location /var/db/pkg to the new
> > > +	   default (December 2020). */
> > > +
> > > +	struct stat sb;
> > > +	if (strcmp(pkgdb_dir, DEF_LOG_DIR) == 0 &&
> > > +	    stat(pkgdb_dir, &sb) == -1 && errno == ENOENT &&
> > > +	    stat("/var/db/pkg", &sb) == 0) {
> > > +		errx(EXIT_FAILURE,
> > > +		     "The default PKG_DBDIR has changed, but this installation still uses the old one.\n"
> > > +		     "Please move the database and re-run this command:\n"
> > > +		     "\tmv /var/db/pkg " DEF_LOG_DIR);
> > > +	}
> > >  
> > > -	return pkgdb_dir;
> > > +        return pkgdb_dir;
> > >  }
> > >  
> > >  /*
> > > 
> > 
> > Main interest to move pkgdb_dir away from /var/db/pkg was that other
> > package managers deposit files there, too. Erroring is only safe on
> > NetBSD.
> 
> It is not even safe on NetBSD.

Can you elaborate on this?
I'm very tempted to turn this case into "use /var/db/pkg" instead of
errx. I am wondering if I missed something.


Home | Main Index | Thread Index | Old Index