Page MenuHomeFreeBSD

freebsd-update: Fix merging already-updated files
ClosedPublic

Authored by cperciva on May 5 2023, 3:17 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Apr 17, 3:06 AM
Unknown Object (File)
Sat, Apr 13, 7:22 AM
Unknown Object (File)
Mar 8 2024, 1:29 AM
Unknown Object (File)
Mar 8 2024, 1:29 AM
Unknown Object (File)
Mar 8 2024, 1:29 AM
Unknown Object (File)
Mar 8 2024, 1:03 AM
Unknown Object (File)
Mar 7 2024, 11:13 PM
Unknown Object (File)
Feb 23 2024, 2:05 AM
Subscribers

Details

Summary

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
MFC after: 7 days
X-EN-Candidate: yes

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This revision is now accepted and ready to land.May 5 2023, 4:36 AM
emaste requested changes to this revision.May 5 2023, 12:28 PM
emaste added a subscriber: emaste.

LGTM with one nit

usr.sbin/freebsd-update/freebsd-update.sh
1680–1682

$3->$4 in comment, and mention $3

This revision now requires changes to proceed.May 5 2023, 12:28 PM

Update comment to match new reality.

LGTM with one nit

Thanks, I've fixed the comment.

This revision is now accepted and ready to land.May 5 2023, 5:09 PM

Can confirm that it fixes the issue for me.