Subject: Re: df(1) on unmounted device works improperly
To: None <david@l8s.co.uk>
From: Ben Harris <bjh21@netbsd.org>
List: current-users
Date: 03/18/2003 11:18:16
In article <20030318101914.P722@snowdrop.l8s.co.uk> you write:
>On Mon, Mar 17, 2003 at 11:07:22PM -0800, Greywolf wrote:
>> Thus spake Simon Burge ("SB> ") sometime Tomorrow...
>> 
>> SB> Greywolf wrote:
>> SB>
>> SB> > Hey, all,
>> SB> >
>> 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>
>> SB> This is from:
>> SB>
>> 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.
>
>Saves worring about adding support for otherfs types - or not knowing
>what the answer means because you don't know whether df understands
>the fs type concerned.
>
>Posix requires the current behaviour, so I'm surprised Solaris will
>look at unmounted fs (it probably has a /usr/xpg4/bin/df though).
>
>We aren't actually comformant anyway:
>
>1) posix requires the default output to show the number of free inodes.
>2) posix requires a -t option show the allocated space.

You're confused.  POSIX (in its current incarnation) is IEEE Std 1003.1-2001
without the XSI extensions.  The -t option to df, the requirements on
handling block devices, and the requirement to display numbers of free
inodes are all XSI extensions, which I think NetBSD should be ignoring.

Without the XSI extensions, the results of passing df the name of a special
file are unspecified, which permits us to grovel around in unmounted
filesystems if we want.

>I don't know where they got there 'default' output rule from!
>the '-t' clashes :-(

This kind of thing is precisely why I think NetBSD should be ignoring XSI.

-- 
Ben Harris                                                   <bjh21@netbsd.org>
Portmaster, NetBSD/acorn26           <URL:http://www.netbsd.org/Ports/acorn26/>