Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Jul 2022 18:01:27 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 5d7b7a98e5ed - stable/13 - etcupdate: Don't rotate trees for a dry run.
Message-ID:  <202207131801.26DI1RJl059104@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by jhb:

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

commit 5d7b7a98e5ed56a33bdafbeb57c2e85e0ae0aab5
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:00:45 +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 acfc601b93af..b686db7d9f9a 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



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