Subject: misc/6566: /var/backups only keep two instances of each "watched" file
To: None <gnats-bugs@gnats.netbsd.org>
From: TheMan <andrew@untraceable.net>
List: netbsd-bugs
Date: 12/11/1998 18:43:17
>Number:         6566
>Category:       misc
>Synopsis:       /var/backups only keep two instances of each "watched" file
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    misc-bug-people (Misc Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Fri Dec 11 15:50:00 1998
>Last-Modified:
>Originator:     TheMan
>Organization:
none really...
>Release:        1.2
>Environment:
System: NetBSD noc 1.2 NetBSD 1.2 (null) #4: Fri Oct 24 01:27:28 EDT 1997 root@noc:/usr/src/sys/arch/i386/compile/null i386
yeah yeah...but it still works...

>Description:

many a time i've wondered when exactly did i make a particular change
to a particular file that i thought /etc/security was watching for me.
indeed it was, but not to the degree that i thought.  it only has
today's and yesterday's version of the file i want.  what i did was
over a week ago.  and i don't remember when or what exactly i did.

>How-To-Repeat:

change something.
change it the next day.
change it again a day or so later.
wonder about the first change.
realize that you can't find out.

>Fix:

modify /etc/security and /etc/security.conf to use rcs for version
control of the files it watches.  be happier.

diff -ru etc.orig/security etc/security
--- etc.orig/security	Tue Sep 15 08:06:01 1998
+++ etc/security	Fri Dec 11 18:29:56 1998
@@ -648,26 +648,48 @@
 		CUR=/var/backups/`basename $file`.current
 		BACK=/var/backups/`basename $file`.backup
 		if [ -f $file ]; then
+			if checkyesno changelist_uses_rcs; then
+				cp $file $CUR
+				chown root.wheel $CUR
+			fi
 			if [ -f $CUR ] ; then
-				diff $CUR $file > $OUTPUT
+				if checkyesno changelist_uses_rcs; then
+					rcsdiff -q $CUR > $OUTPUT 2>/dev/null
+				else
+					diff $CUR $file > $OUTPUT
+				fi
 				if [ -s $OUTPUT ] ; then
 		printf "\n======\n%s diffs (OLD < > NEW)\n======\n" $file
 					cat $OUTPUT
-					mv -f $CUR $BACK
-					cp -p $file $CUR
-					chown root.wheel $CUR
+					if checkyesno changelist_uses_rcs; then
+						ci -q -l -f -m"security checkin" $CUR
+					else
+						mv -f $CUR $BACK
+						cp -p $file $CUR
+						chown root.wheel $CUR
+					fi
 				fi
 			else
 		printf "\n======\n%s added\n======\n" $file
-				diff /dev/null $file
-				cp -p $file $CUR
-				chown root.wheel $CUR
+				if checkyesno changelist_uses_rcs; then
+					ci -q -f -m"security checkin" -t-"security changelist" $CUR
+					rcs -ko $CUR
+					co -l $CUR
+				else
+					diff /dev/null $file
+					cp -p $file $CUR
+					chown root.wheel $CUR
+				fi
 			fi
 		else
 			if [ -f $CUR ]; then
 		printf "\n======\n%s removed\n======\n" $file
 				diff $CUR /dev/null
-				mv -f $CUR $BACK
+				if checkyesno changelist_uses_rcs; then
+					rm -f $CUR
+				else
+					mv -f $CUR $BACK
+				fi
 			fi
 		fi
 	done
diff -ru etc.orig/security.conf etc/security.conf
--- etc.orig/security.conf	Wed Aug 26 08:04:19 1998
+++ etc/security.conf	Thu Dec 10 12:16:51 1998
@@ -15,3 +15,4 @@
 check_mtree=YES
 check_disklabels=YES
 check_changelist=YES
+changelist_uses_rcs=NO
>Audit-Trail:
>Unformatted: