aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2022-12-14 17:34:59 +0000
committerEd Maste <emaste@FreeBSD.org>2023-03-02 01:20:33 +0000
commitceb5f28ba5fcfa69de7410d2327d4a5abf2a421f (patch)
treebdac0bee45720297d53a3f7d3d671128ac8c5f2e
parentc5e54e56e68aa50beb7d2a7b8ae6611490a7ba9e (diff)
downloadsrc-ceb5f28ba5fcfa69de7410d2327.tar.gz
src-ceb5f28ba5fcfa69de7410d2327.zip
freebsd-update: re-edit files if merge conflict markers remain
freebsd-update will open ${EDITOR} if conflicts occur while merging updates to config files. Inform the user if they've left conflict markers behind, and go back to editing the file. PR: 185546 PR: 229689 Reviewed by: delphij Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D37703
-rw-r--r--usr.sbin/freebsd-update/freebsd-update.sh17
1 files changed, 15 insertions, 2 deletions
diff --git a/usr.sbin/freebsd-update/freebsd-update.sh b/usr.sbin/freebsd-update/freebsd-update.sh
index b6cd241c4a48..225d1e31e3ec 100644
--- a/usr.sbin/freebsd-update/freebsd-update.sh
+++ b/usr.sbin/freebsd-update/freebsd-update.sh
@@ -2543,8 +2543,21 @@ The following file could not be merged automatically: ${F}
Press Enter to edit this file in ${EDITOR} and resolve the conflicts
manually...
EOF
- read dummy </dev/tty
- ${EDITOR} `pwd`/merge/new/${F} < /dev/tty
+ while true; do
+ read dummy </dev/tty
+ ${EDITOR} `pwd`/merge/new/${F} < /dev/tty
+
+ if ! egrep -q '^(<<<<<<<|=======|>>>>>>>)([[:space:]].*)?$' $(pwd)/merge/new/${F} ; then
+ break
+ fi
+ cat <<-EOF
+
+Merge conflict markers remain in: ${F}
+These must be resolved for the system to be functional.
+
+Press Enter to return to editing this file.
+ EOF
+ done
done < failed.merges
rm failed.merges