Skip to content

Commit

Permalink
freebsd-update: handle file -> directory on upgrade
Browse files Browse the repository at this point in the history
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 f6d37c9)
(cherry picked from commit 2742818)
  • Loading branch information
emaste authored and tetlowgm committed Oct 3, 2023
1 parent 193b7e3 commit 0eb6c27
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion usr.sbin/freebsd-update/freebsd-update.sh
Expand Up @@ -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}
;;
Expand Down

0 comments on commit 0eb6c27

Please sign in to comment.