]> 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)
committerGordon Tetlow <gordon@FreeBSD.org>
Wed, 6 Sep 2023 16:56:24 +0000 (09:56 -0700)
commit0b39d9de2e7170c214b39f1aca42c11d6f7c13e9
tree9f9e82c121064340df032429abae1e3fc4a85014
parent4341433a673fde3e1c1554b9daa15d4db71f6edb
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
Approved by: so
Security: FreeBSD-EN-23:09.freebsd-update
Differential Revision: https://reviews.freebsd.org/D39973

(cherry picked from commit c55b7e522629cb78adeb54bd9964304481d55eab)
(cherry picked from commit 866e5c6b3ce7ca3e15a24180fa1a0dcbda7c4b0f)
usr.sbin/freebsd-update/freebsd-update.sh