Subject: bin/32666: /etc/security may cause tapes to rewind
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: Duncan McEwan <duncan@mcs.vuw.ac.nz>
List: netbsd-bugs
Date: 01/29/2006 22:50:00
>Number: 32666
>Category: bin
>Synopsis: /etc/security may cause tapes to rewind
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Sun Jan 29 22:50:00 +0000 2006
>Originator: Duncan McEwan
>Release: NetBSD 3.99.11
>Organization:
School of Mathematics, Statistics and Compter Science,
Victoria University of Wellington, New Zealand
>Environment:
System: NetBSD shed11.mcs.vuw.ac.nz 3.99.11 NetBSD 3.99.11 (MCS_WORKSTATION) #1: Mon Nov 21 15:43:44 NZDT 2005 mark@turakirae.mcs.vuw.ac.nz:/mnt/SAVE/build.obj/src/work/src/sys/arch/i386/compile/MCS_WORKSTATION i386
Architecture: i386
Machine: i386
>Description:
If the /etc/security script is configured to check disklabels it uses
iostat to get a list of disks to check. However since "iostat -x"
was modified to return statistics for tape devices, "st0" is now
included in its output. So /etc/security runs "disklabel st0",
which:
(a) gives an error "disklabel: ioctl DIOCGDINFO: Bad file descriptor"
(b) causes any tape left in the tape drive to be rewound
>How-To-Repeat:
Leave tape in tape drive and run "mt -t /dev/nrst0 fsf 1"
Ensure that you don't have check_disklabels=NO in /etc/security.conf
After /etc/security has run type "mt -t /dev/nrst0 status" and observe
that the tape is now positioned at file 0.
>Fix:
Maybe add an option to iostat so that /etc/security has a way of
getting just a list of real disks? Or apply a patch similar to the
following to /etc/security?
*** /etc/security.orig Fri Jul 1 00:15:33 2005
--- /etc/security Mon Jan 30 11:30:28 2006
***************
*** 807,814 ****
egrep -v '\.(backup|current)(,v)?$' > $LABELS
xargs rm < $LABELS
! # generate disklabels of all disks excluding: cd fd md
! disks=`iostat -x | awk 'NR > 1 && $1 !~ /^[cfm]d/ { print $1; }'`
for i in $disks; do
disklabel $i > "$work_dir/disklabel.$i" 2>/dev/null
done
--- 807,814 ----
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/ { print $1; }'`
for i in $disks; do
disklabel $i > "$work_dir/disklabel.$i" 2>/dev/null
done