]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
freebsd-update: Fix merging already-updated files
authorColin Percival <cperciva@FreeBSD.org>
Fri, 5 May 2023 03:00:58 +0000 (20:00 -0700)
committerColin Percival <cperciva@FreeBSD.org>
Tue, 9 May 2023 23:28:09 +0000 (16:28 -0700)
commitc55b7e522629cb78adeb54bd9964304481d55eab
tree5735a5dbbf9c84be9575013944a3b2c10584fc30
parentf5f1b9a9828a4fdf5b0ba51b291e0e1e7ac7b55f
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,

2. 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
usr.sbin/freebsd-update/freebsd-update.sh