Re: Questions about pkgbase

From: Lexi Winter <ivy_at_freebsd.org>
Date: Thu, 02 Oct 2025 09:35:10 UTC
Gleb Popov wrote in <CALH631=ioRih8n-DhD0D1CWjp3kbqemeJUzq2kBgg8GORjAN3g@mail.gmail.com>:
> > pkg(8) will attempt a 3-way merge when installing a new configuration
> > file.  if this is successful, no action is required.  if it fails, the
> > existing file will be left unchanged and pkg will create a <name>.pkgnew
> > file, which you need to manually merge with the existing version of the
> > file.
> >
> > this workflow is much worse than etcupdate or freebsd-update, and i'm
> > not convinced we should release with pkgbase as the recommended option
> > without a better solution, but we'll see.
> 
> Doesn't etcupdate perform the same 3-way merge during its operation?
> My understanding is that pkg and etcupdate will produce the same
> results for the same inputs.

yes, the merge functionality is the same (more or less), but the result
for the user is worse: etcupdate makes it clear which files failed to
merge and offers a manual resolution of the merge with conflict markers,
while pkg just prints a message, which is usually lost in the hundreds
of other messages printed during an upgrade, and requires the user to
manually locate the unmerged files via find / -name '*.pkgnew', then
you only get the old and new files with no way to easily see what has
changed in the new version of the file.  (basically, this is a manual
two-way merge.)

if there's a better way to do this with pkg, i'd definitely like to know
about it.