Subject: bin/17247: /etc/security should allow diff(1)'s option.
To: None <gnats-bugs@gnats.netbsd.org>
From: Takahiro Kambe <taca@sky.yamashina.kyoto.jp>
List: netbsd-bugs
Date: 06/14/2002 00:39:52
>Number:         17247
>Category:       bin
>Synopsis:       /etc/security should allow to specify diff(1)'s option.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Thu Jun 13 09:05:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Takahiro Kambe
>Release:        NetBSD 1.6_BETA1
>Organization:
	
>Environment:
	
	
System: NetBSD edge.sky.yamashina.kyoto.jp 1.6_BETA1 NetBSD 1.6_BETA1 (FIVA20X) #145: Sat Jun 8 14:34:16 JST 2002 taca@edge.sky.yamashina.kyoto.jp:/usr/src/sys/arch/i386/compile/FIVA20X i386
Architecture: i386
Machine: i386
>Description:
	/etc/security reports changes in some files with diff(1).
	Currently, it dosen't specify any option for diff(1) and diff(1)'s
	output isn't easy to read for me.

	This problem is solved by adding a new config parameter for
	/etc/security.  Using unified or context diff(1)'s output results
	some benefits.

	- Better readability (but it depends on person's taste)
	- Some additional information, files time stamp.
	- Smaller output (with unified diff)?

>How-To-Repeat:
	
>Fix:
	Apply attached diff.

	P.S.
	It derived from my local CVS repositry.

Index: etc/defaults/security.conf
diff -u -r1.1.1.3 -r1.1.4.2.2.2
--- etc/defaults/security.conf	2002/06/02 11:18:45	1.1.1.3
+++ etc/defaults/security.conf	2002/06/11 08:15:18	1.1.4.2.2.2
@@ -26,6 +26,7 @@
 
 backup_dir=/var/backups
 backup_uses_rcs=YES
+diff_options=-u
 pkgdb_dir=/var/db/pkg
 
 max_loginlen=8
Index: etc/security
diff -u -r1.1.1.7 -r1.1.1.4.4.2.2.2
--- etc/security	2002/06/02 11:18:26	1.1.1.7
+++ etc/security	2002/06/11 08:15:16	1.1.1.4.4.2.2.2
@@ -26,6 +26,7 @@
 pkgdb_dir=${pkgdb_dir:-/var/db/pkg}
 max_loginlen=${max_loginlen:-8}
 max_grouplen=${max_grouplen:-8}
+diff_options=${diff_options:--u}
 
 # Other configurable variables
 #
@@ -130,7 +131,7 @@
 	if [ -f $_file ]; then
 		if [ -f $CUR ] ; then
 			if [ "$_printdiff" -ne 0 ]; then
-				diff $CUR $_file > $OUTPUT
+				diff ${diff_options} $CUR $_file > $OUTPUT
 			else
 				if ! cmp -s $CUR $_file; then
 					echo "[changes omitted]"
@@ -145,7 +146,7 @@
 		else
 			printf "\n======\n%s added\n======\n" $_file
 			if [ "$_printdiff" -ne 0 ]; then
-				diff /dev/null $_file
+				diff ${diff_options} /dev/null $_file
 			else
 				echo "[changes omitted]"
 			fi
@@ -155,7 +156,7 @@
 		if [ -f $CUR ]; then
 			printf "\n======\n%s removed\n======\n" $_file
 			if [ "$_printdiff" -ne 0 ]; then
-				diff $CUR /dev/null
+				diff ${diff_options} $CUR /dev/null
 			else
 				echo "[changes omitted]"
 			fi

>Release-Note:
>Audit-Trail:
>Unformatted: