Subject: Re: df(1) on unmounted device works improperly
To: Simon Burge <firstname.lastname@example.org>
From: Greywolf <email@example.com>
Date: 03/17/2003 23:07:22
Thus spake Simon Burge ("SB> ") sometime Tomorrow...
SB> Greywolf wrote:
SB> > Hey, all,
SB> > with -current kernel and userland as of a week ago (and, it seems, as
SB> > far back as 1.6M, if not farther), df(1) does The Wrong Thing.
SB> This is from:
SB> revision 1.43
SB> date: 2002/08/02 08:17:12; author: soren; state: Exp; lines: +4 -113
SB> Following FreeBSD's example, remove the old pre-statfs(2) code for
SB> examining FFS filesystems directly. This also gets rid of df(1)'s
SB> setgid operator bit.
SB> of df.c.
SB> I think maybe an acceptable compromise would be to add the code back but
SB> don't add the setgid bit so that the user must have read access to the
SB> device to use the old block query method. Does this sound reasonable?
It's acceptable to me, if a bit hackish -- didn't realise it had vanished
that long ago. I don't mind the no-setgid bit as I'm usually super-
user when I'm doing this.
The ultimate solution would, of course, be to allow statfs(2) to stat an
unmounted filesystem, but that could be fraught with further insecurity.
If it's not desired, I won't complain too much, but it would have saved
me 40% of about three 'newfs, mount, df, df -i, umount' iterations.
NetBSD: Resistance is NOT futile!