[Bug 273950] freebsd-update rollback (from 14.0-BETA2 back to 13.2) fails

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 25 Sep 2023 17:54:53 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=273950

--- Comment #1 from Ed Maste <emaste@freebsd.org> ---
In 13 these are in /lib/casper, e.g. /lib/casper/libcap_net.so.1
In 14 they are in lib, e.g. /lib/libcap_net.so.1

After running the first 'sh freebsd-update.sh install', an install.Fuk6PT
directory is created:
lrwxr-xr-x  1 root  wheel       14 Sep 25 17:20
f465c3739385890c221dff1a05e578c6cae0d0430e46996d319db7439f884336-install ->
install.Fuk6PT

grep '/lib/casper/' INDEX* in there:

/var/db/freebsd-update/install.Fuk6PT/INDEX-OLD:/lib/casper/libcap_dns.so.2|f|0|0|0444|0|1a1d07bf89222c1ea8c7d051ab89844dde4444f93dad798f2d08069330b5b98e|
/var/db/freebsd-update/install.Fuk6PT/INDEX-OLD:/lib/casper/libcap_fileargs.so.1|f|0|0|0444|0|e93b3eab9f04913eb7aefa8576a3fd7d593325b0901f9a462f12682045a8452a|
/var/db/freebsd-update/install.Fuk6PT/INDEX-OLD:/lib/casper/libcap_grp.so.1|f|0|0|0444|0|848714e6a5fb2633e5b6cff16fd936aecefc77488dfb7c8333ce4e5c26dea047|
/var/db/freebsd-update/install.Fuk6PT/INDEX-OLD:/lib/casper/libcap_net.so.1|f|0|0|0444|0|1d001dd45a61ea50e3b4cc9d42fe0e2c0b51ca671fe6db939dea43a859b9c695|
/var/db/freebsd-update/install.Fuk6PT/INDEX-OLD:/lib/casper/libcap_pwd.so.1|f|0|0|0444|0|80a37d372633979b8cd50ea7f550c5f5a054a9c1c14f359bd971e1ea1fb5dec9|
/var/db/freebsd-update/install.Fuk6PT/INDEX-OLD:/lib/casper/libcap_sysctl.so.2|f|0|0|0444|0|3de8a10f163de8ea9d7541677c523147a9b0206e436cc342a31258e2e85af123|
/var/db/freebsd-update/install.Fuk6PT/INDEX-OLD:/lib/casper/libcap_syslog.so.1|f|0|0|0444|0|078fe519e3526e955ec72ce178bb4b66bb31273155e093d397bd296b4fb04a48|
/var/db/freebsd-update/install.Fuk6PT/INDEX-OLD:/lib/casper|d|0|0|0755|0||
/var/db/freebsd-update/install.Fuk6PT/INDEX-OLD:/usr/lib/libcap_dns.so|L|0|0|0755|0|../../lib/casper/libcap_dns.so.2|
/var/db/freebsd-update/install.Fuk6PT/INDEX-OLD:/usr/lib/libcap_fileargs.so|L|0|0|0755|0|../../lib/casper/libcap_fileargs.so.1|
/var/db/freebsd-update/install.Fuk6PT/INDEX-OLD:/usr/lib/libcap_grp.so|L|0|0|0755|0|../../lib/casper/libcap_grp.so.1|
/var/db/freebsd-update/install.Fuk6PT/INDEX-OLD:/usr/lib/libcap_net.so|L|0|0|0755|0|../../lib/casper/libcap_net.so.1|
/var/db/freebsd-update/install.Fuk6PT/INDEX-OLD:/usr/lib/libcap_pwd.so|L|0|0|0755|0|../../lib/casper/libcap_pwd.so.1|
/var/db/freebsd-update/install.Fuk6PT/INDEX-OLD:/usr/lib/libcap_sysctl.so|L|0|0|0755|0|../../lib/casper/libcap_sysctl.so.2|
/var/db/freebsd-update/install.Fuk6PT/INDEX-OLD:/usr/lib/libcap_syslog.so|L|0|0|0755|0|../../lib/casper/libcap_syslog.so.1|

freebsd-update.sh:

# Install old files, delete new files, and update linker.hints
rollback_files () {
        # Install old shared library files which don't have the same path as
        # a new shared library file.
        grep -vE '^/boot/' $1/INDEX-NEW |
            grep -E '/lib/.*\.so\.[0-9]+\|' |
            cut -f 1 -d '|' |
            sort > INDEX-NEW.libs.flist
        grep -vE '^/boot/' $1/INDEX-OLD |
            grep -E '/lib/.*\.so\.[0-9]+\|' |
            sort -k 1,1 -t '|' - |
            join -t '|' -v 1 - INDEX-NEW.libs.flist > INDEX-OLD
        install_from_index INDEX-OLD || return 1

So there are two issues:
1) We attempt to install /lib/casper/* via the first block in rollback_files()
before /lib/casper has been recreated.
2) The /lib/casper directory entry appears after all of the files that it
contains, in INDEX-OLD.

-- 
You are receiving this mail because:
You are the assignee for the bug.