HomeFreeBSD

freebsd-update: Fix merging already-updated files

Description

freebsd-update: Fix merging already-updated files

When performing an "upgrade" (moving between FreeBSD releases, as
opposed to "update" which merely applies security/errata updates
to the installed release) FreeBSD Update:

  1. Generates a list of "files needing to be merged", namely those

files which don't match the version installed in the "old" release
and have paths matching the MergeChanges configuration directive
(by default, /boot/device.hints and everything under /etc/).

and later on,

  1. Compares the currently-installed files to the versions in the

"new" release, removing index entries for files which "don't need
to be updated because they're not changing".

Unfortunately if a file falls into both of these categories -- that
is to say, if a file in /etc/ is the same as the version in the new
release and not the same as the version in the old release -- the
resulting "merge" step saw that the file was no longer listed as
being part of the new release, resulting in the file being deleted.

For the first 18 years of FreeBSD Update's existence, this never
happened, since $FreeBSD$ tags resulted in "new release" files
always being different from any files systems would already have
installed.

This commit fixes this behaviour by only placing a file into the
"files needing to be merged" list if it does not match the version
in the old release *or* the version in the new release.

Reported by: des
Reviewed by: delphij (earlier version), des, emaste
MFC after: 7 days
X-EN-Candidate: yes
Differential Revision: https://reviews.freebsd.org/D39973

(cherry picked from commit c55b7e522629cb78adeb54bd9964304481d55eab)

Details

Provenance
cpercivaAuthored on May 5 2023, 3:00 AM
Reviewer
delphij
Differential Revision
D39973: freebsd-update: Fix merging already-updated files
Parents
rGe9f9e3f4086f: nfsd: Continue adding macros so nfsd can run in a vnet prison
Branches
Unknown
Tags
Unknown