diff options
author | Ed Maste <emaste@FreeBSD.org> | 2023-09-27 13:36:33 +0000 |
---|---|---|
committer | Gordon Tetlow <gordon@FreeBSD.org> | 2023-10-03 21:10:42 +0000 |
commit | 0eb6c273622d77a89115e7d4f01609eefc50b33c (patch) | |
tree | 64e58f6a4ed7c885127b5e38b2c5f9e91d4f6fd4 | |
parent | 193b7e3d0af5205f770c30620711889eff324ae8 (diff) | |
download | src-0eb6c273622d77a89115e7d4f01609eefc50b33c.tar.gz src-0eb6c273622d77a89115e7d4f01609eefc50b33c.zip |
freebsd-update: handle file -> directory on upgrade
Upgrading from FreeBSD 13.2 to 14.0 failed with
install: ///usr/include/c++/v1/__string exists but is not a directory
because __string changed from a file to a directory with an LLVM
upgrade.
Now, remove the existing file when the type conflicts. Note that this
is only an interim fix to facilitate upgrades from 13.2 for 14.0 BETA
testing. This change does not handle the directory -> file case and
further work is needed.
PR: 273661
Reviewed by: dim, gordon
Approved by: so
Security: FreeBSD-EN-23:12.freebsd-update
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41893
(cherry picked from commit f6d37c9ca13f8ab0ef32cf5344daecb8122d1e85)
(cherry picked from commit 274281864fc03c62443677751bf3036fbbf9d778)
-rw-r--r-- | usr.sbin/freebsd-update/freebsd-update.sh | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/usr.sbin/freebsd-update/freebsd-update.sh b/usr.sbin/freebsd-update/freebsd-update.sh index 57d94a25881a..324e838fd8a7 100644 --- a/usr.sbin/freebsd-update/freebsd-update.sh +++ b/usr.sbin/freebsd-update/freebsd-update.sh @@ -2892,7 +2892,13 @@ install_from_index () { while read FPATH TYPE OWNER GROUP PERM FLAGS HASH LINK; do case ${TYPE} in d) - # Create a directory + # Create a directory. A file may change to a directory + # on upgrade (PR273661). If that happens, remove the + # file first. + if [ -e "${BASEDIR}/${FPATH}" ] && \ + ! [ -d "${BASEDIR}/${FPATH}" ]; then + rm -f -- "${BASEDIR}/${FPATH}" + fi install -d -o ${OWNER} -g ${GROUP} \ -m ${PERM} ${BASEDIR}/${FPATH} ;; |