Subject: Re: misc/36747 (wedges in /etc/security)
To: None <netbsd-bugs@NetBSD.org>
From: Matthias Scheler <tron@NetBSD.org>
List: netbsd-bugs
Date: 08/08/2007 19:57:48
On Wed, Aug 08, 2007 at 12:05:25PM +0000, tron@NetBSD.org wrote:
> Synopsis: wedges in /etc/security
> 
> Responsible-Changed-From-To: misc-bug-people->tron
> Responsible-Changed-By: tron@netbsd.org
> Responsible-Changed-When: Wed, 08 Aug 2007 12:05:24 +0000
> Responsible-Changed-Why:
> I'll handle this PR.

Here is an improved version of your patch. It recognizes all the kinds
of disk devices suggested on the "tech-kern" mailing list:

Index: etc/security
===================================================================
RCS file: /cvsroot/src/etc/security,v
retrieving revision 1.100.2.2
diff -u -r1.100.2.2 security
--- etc/security	6 Jun 2007 14:58:14 -0000	1.100.2.2
+++ etc/security	8 Aug 2007 18:56:17 -0000
@@ -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
@@ -868,8 +868,16 @@
 		done
 	fi
 
-		# append list of new disklabels and fdisks
-	ls -1d $work_dir/disklabel.* $work_dir/fdisk.* 2>/dev/null |
+		# if dkctl is available, generate dkctl listwedges for:	ed ld sd wd cgd ofdisk ra raid rl
+	if [ -x /sbin/dkctl ]; then
+		disks=`iostat -x| awk 'NR > 1 && $1 ~ /^[elsw]d|cgd|ofdisk|ra|raid,rl/ { 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, 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

	Kind regards

-- 
Matthias Scheler                                  http://zhadum.org.uk/