Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Sep 2023 19:23:50 GMT
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: f6d37c9ca13f - main - freebsd-update: handle file -> directory on upgrade
Message-ID:  <202309271923.38RJNo0L076075@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=f6d37c9ca13f8ab0ef32cf5344daecb8122d1e85

commit f6d37c9ca13f8ab0ef32cf5344daecb8122d1e85
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2023-09-27 13:36:33 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2023-09-27 19:23:08 +0000

    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
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D41893
---
 usr.sbin/freebsd-update/freebsd-update.sh | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/usr.sbin/freebsd-update/freebsd-update.sh b/usr.sbin/freebsd-update/freebsd-update.sh
index 29633b51b26c..c6432dcd6b0e 100644
--- a/usr.sbin/freebsd-update/freebsd-update.sh
+++ b/usr.sbin/freebsd-update/freebsd-update.sh
@@ -2903,7 +2903,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}
 			;;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202309271923.38RJNo0L076075>