Re: pkgbase checksums

From: Baptiste Daroussin <bapt_at_FreeBSD.org>
Date: Thu, 13 Jan 2022 12:57:30 UTC
On Thu, Jan 13, 2022 at 11:33:55AM +0100, Stefan Esser wrote:
> Am 13.01.22 um 10:36 schrieb Henrik Rosenke:
> > Hello,
> > 
> > what is the correct way to handle pkg checksum mismatches in pkgbase? (pkg
> > check -sa)
> > For example after installing bash or editing /etc/hosts there are checksum
> > mismatches:
> > 
> >     FreeBSD-clibs-12.2.s20220105232846: checksum mismatch for /etc/hosts
> >     FreeBSD-clibs-12.2.s20220105232846: checksum mismatch for /etc/shells
> > 
> > I workaround this after setting up the jail by executing pkg check -r but this
> > doesnt seem right to me. Also this doesnt handle modifications made afterwards.
> > In normal pkgs we got the ability to provide a default and modify this, for
> > this files no checksums are stored from what i know.
> 
> I'm not a pkgbase user, but I'd think that this could be fixed
> by using @sample to have e.g. /etc/hosts.sample with a checksum,
> which is copied to /etc/hosts if that file does not exist during
> installation.
> 
> This logic works great for ports, but had the disadvantage of
> doubling the number of files in /etc that are installed that way,
> since the .sample file will have to stay as part of the installed
> pkgbase package and may occasionally be updated.
> 
> That would also allow a special version of etcupdate to detect
> changed .sample files and to perform a 3-way merge on the installed
> files as is possible when building from source.
> 
> Regards, STefan

We have @config for base were pkg will do a 3 way merge, just those files are
probably not marked as @config and should.

(@config is native while @sample is external and define only in the ports tree)

if they are marked as such, then it means we have a bug in pkg checksum as it
should not check the checksum of the files marked @config

Best regards,
Bapt