git: c4aa309d232c - stable/12 - etcupdate: Don't rotate trees for a dry run.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 13 Jul 2022 18:01:34 UTC
The branch stable/12 has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=c4aa309d232cd1014e6eaae7043c29f8d45f5319
commit c4aa309d232cd1014e6eaae7043c29f8d45f5319
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-05-25 21:02:51 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-07-13 18:01:04 +0000
etcupdate: Don't rotate trees for a dry run.
When performing a dry run, remove the temporary tree created rather
than rotating the trees. Rotating the trees meant that etcupdate
thought the latest changes were already merged and would not merge
them on the next real run.
PR: 260281
Reported by: Tomoaki AOKI <junchoon@dec.sakura.ne.jp>
Fixes: 0611aec3cf3a etcupdate: Always extract to a temporary tree.
(cherry picked from commit 431944fb5ffff5ad56e720b75b7beecdc4878e0e)
---
usr.sbin/etcupdate/etcupdate.sh | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/usr.sbin/etcupdate/etcupdate.sh b/usr.sbin/etcupdate/etcupdate.sh
index 1070c6905e46..3715dea7e95c 100755
--- a/usr.sbin/etcupdate/etcupdate.sh
+++ b/usr.sbin/etcupdate/etcupdate.sh
@@ -1612,6 +1612,18 @@ EOF
cat $WARNINGS
fi
+ # If this was a dryrun, remove the temporary tree if we built
+ # a new one.
+ if [ -n "$dryrun" ]; then
+ if [ -n "$dir" ]; then
+ if [ -n "$rerun" ]; then
+ panic "Should not have a temporary directory"
+ fi
+ remove_tree $dir
+ fi
+ return
+ fi
+
# Finally, rotate any needed trees.
if [ "$new" != "$NEWTREE" ]; then
if [ -n "$rerun" ]; then