Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 Apr 2026 11:37:56 +0000
From:      Andrey V. Elsukov <ae@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Cc:        Boris Lytochkin <lytboris@gmail.com>
Subject:   git: 6d65c91b9a47 - main - etcupdate: fix arguments order of diff command
Message-ID:  <69f33f14.21ffc.507c8a33@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by ae:

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

commit 6d65c91b9a4743bbffc3508bf754e68b65bbd494
Author:     Boris Lytochkin <lytboris@gmail.com>
AuthorDate: 2026-04-30 11:31:34 +0000
Commit:     Andrey V. Elsukov <ae@FreeBSD.org>
CommitDate: 2026-04-30 11:31:34 +0000

    etcupdate: fix arguments order of diff command
    
    Due to misplacement of the second -L argument of diff command, it is
    treated by getopt_long as an error.
    
    Also add -l option for a diff command that alters the way it shows
    differences. Instead of printing full diff, it reports changed file
    the same way as added/removed files are reported.
    
    Reviewed by:    imp
    Obtained from:  Yandex LLC
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D56708
---
 usr.sbin/etcupdate/etcupdate.8  |  7 ++++++-
 usr.sbin/etcupdate/etcupdate.sh | 14 ++++++++++++--
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/usr.sbin/etcupdate/etcupdate.8 b/usr.sbin/etcupdate/etcupdate.8
index bf7ddb792907..6216722fc81f 100644
--- a/usr.sbin/etcupdate/etcupdate.8
+++ b/usr.sbin/etcupdate/etcupdate.8
@@ -23,7 +23,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd July 15, 2024
+.Dd April 30, 2026
 .Dt ETCUPDATE 8
 .Os
 .Sh NAME
@@ -51,6 +51,7 @@
 .Ar tarball
 .Nm
 .Cm diff
+.Op Fl l
 .Op Fl d Ar workdir
 .Op Fl D Ar destdir
 .Op Fl I Ar patterns
@@ -468,6 +469,10 @@ shell pattern.
 This option may be specified multiple times to specify multiple patterns.
 Multiple space-separated patterns may also be specified in a single
 option.
+.It Fl l
+In
+.Cm diff
+mode list files that are changed locally, omit printing content difference.
 .It Fl L Ar logfile
 Specify an alternate path for the log file.
 The
diff --git a/usr.sbin/etcupdate/etcupdate.sh b/usr.sbin/etcupdate/etcupdate.sh
index 8f4737136d72..3ff11ec836ae 100755
--- a/usr.sbin/etcupdate/etcupdate.sh
+++ b/usr.sbin/etcupdate/etcupdate.sh
@@ -527,9 +527,15 @@ diffnode()
 			echo
 			;;
 		$COMPARE_DIFFFILES)
+			if [ -n "$difflistonly" ]; then
+				echo
+				echo "Changed: $3"
+				echo
+				break;
+			fi
 			echo "Index: $3"
 			rule "="
-			diff -u $diffargs -L "$3 ($4)" $1/$3 -L "$3 ($5)" $2/$3
+			diff -u $diffargs -L "$3 ($4)" -L "$3 ($5)" $1/$3 $2/$3
 			;;
 	esac
 }
@@ -1787,11 +1793,15 @@ ignore=
 nobuild=
 preworld=
 noroot=
-while getopts "d:m:nprs:t:A:BD:FI:L:M:N" option; do
+difflistonly=
+while getopts "d:lm:nprs:t:A:BD:FI:L:M:N" option; do
 	case "$option" in
 		d)
 			WORKDIR=$OPTARG
 			;;
+		l)
+			difflistonly=YES
+			;;
 		m)
 			MAKE_CMD=$OPTARG
 			;;


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69f33f14.21ffc.507c8a33>