Subject: misc/36747: wedges in /etc/security
To: None <misc-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <andreas@planix.com>
List: netbsd-bugs
Date: 08/07/2007 19:35:00
>Number:         36747
>Category:       misc
>Synopsis:       wedges in /etc/security
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    misc-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Tue Aug 07 19:35:00 +0000 2007
>Originator:     Andreas Wrede
>Release:        NetBSD 4.0_BETA2
>Organization:
Andreas Wrede              Planix, Inc.
andreas@planix.com         Networking, System Administration, Consulting
http://www.planix.com      Toronto, Ontario, Canada

"The steady state of disks is full."
                               -- Ken Thompson
>Environment:
	
	
System: NetBSD whome.planix.com 4.0_BETA2 NetBSD 4.0_BETA2 (PLANIX.MPACPI) #235: Sat Jul 21 12:52:28 EDT 2007 root@whome.planix.com:/u2/netbsd-4.0/obj.i386/sys/arch/i386/compile/PLANIX.MPACPI i386

Architecture: i386
Machine: i386
>Description:
	Wedge definitions are not backed up by /etc/security, unlike disklabels and fdisks
>How-To-Repeat:
	After defining some wedges, examine the output of /etc/security
>Fix:
	The patch below backs up wedges just like fdisk partion definitions.


--- /u2/netbsd-4.0/destdir.i386/etc/security	2007-08-06 04:42:46.000000000 -0400
+++ /etc/security	2007-08-07 09:38:16.000000000 -0400
@@ -849,13 +849,13 @@
 		migrate_file "$file" "$work_dir/${file##*/}"
 	done
 
-		# generate list of old disklabels & fdisks and remove them
-	ls -1d $work_dir/disklabel.* $work_dir/fdisk.* 2>/dev/null |
+		# generate list of old disklabels, fdisks & wedges and remove them
+	ls -1d $work_dir/disklabel.* $work_dir/fdisk.* $work_dir/wedges.* 2>/dev/null |
 	    egrep -v '\.(backup|current)(,v)?$' > $LABELS
 	xargs rm < $LABELS
 
-		# generate disklabels of all disks excluding:	cd fd md st
-	disks=`iostat -x | awk 'NR > 1 && $1 !~ /^[cfm]d|st|nfs/ { print $1; }'`
+		# generate disklabels of all disks excluding:	cd dk fd md st
+	disks=`iostat -x | awk 'NR > 1 && $1 !~ /^[cfm]d|dk|st|nfs/ { print $1; }'`
 	for i in $disks; do
 		disklabel $i > "$work_dir/disklabel.$i" 2>/dev/null
 	done
@@ -867,9 +867,16 @@
 			/sbin/fdisk $i > "$work_dir/fdisk.$i" 2>/dev/null
 		done
 	fi
+		# if dkctl is available, generate dkctl listwedges for:	ed ld sd wd
+	if [ -x /sbin/dkctl ]; then
+		disks=`iostat -x| awk 'NR > 1 && $1 ~ /^[elsw]d/ { print $1; }'`
+		for i in $disks; do
+			/sbin/dkctl $i listwedges > "$work_dir/wedges.$i" 2>/dev/null
+		done
+	fi
 
-		# append list of new disklabels and fdisks
-	ls -1d $work_dir/disklabel.* $work_dir/fdisk.* 2>/dev/null |
+		# append list of new disklabels, fdisks and wedges
+	ls -1d $work_dir/disklabel.* $work_dir/fdisk.* $work_dir/wedges.* 2>/dev/null |
 	    egrep -v '\.(backup|current)(,v)?$' >> $LABELS
 	CHANGELIST="$LABELS $CHANGELIST"
 fi

>Unformatted: