Subject: Re: less-wide df(1) output
To: NetBSD Miscellaneous Technical Discussion List <tech-misc@netbsd.org>
From: Greg A. Woods <woods@weird.com>
List: tech-misc
Date: 10/07/2002 13:29:38
[ On , October 7, 2002 at 14:41:56 (+0200), Klaus Klein wrote: ]
> Subject: Re: less-wide df(1) output
>
> While I agree that your point of a portable and effortlessly parsable
> output may be desirable at times, I haven't yet come across an
> implementation deployed where the optional column alignment for human
> readers isn't performed.

True enough, but I think the real question here is to ask how many human
readers will ever type "df -P", especially on a *BSD where the default
output is already essentially (sans the header labels) identical to the
POSIX specified form.  I've never before typed "df -P" on any system
except to see how it differs (and to see if it's supported).  On SunOS-5
I type "df -k" to get the *BSD/POSIX form of output, because I find the
naive column alignment from '/usr/xpg4/bin/df -P' even worse than the
also naive alignment done by "/usr/bin/df -k".  :-)

>  So NetBSD's particular output would be
> easier to handle in cut(1) without prior processing, but I'm not
> convinced that an application taking advantage of this, which is
> broken when used on (supposedly) almost every conforming
> implementation, would be quite useful in general.

Can't NetBSD be the originating host for some applications?  :-)

And do all applications have to be portable?  :-)  Sometimes what
"portable" refers to are the programmers skills, not the programs.
If a Solaris programmer comes to write a NetBSD application and is
pleasantly surprised to find that 'df -P' produces really easily parsed
output, then is that not a good thing?  :-)

In any case a truly portable application which does the multi-space
collapsing with sed or whatever will still work properly with a "df -P"
that doesn't bother to align columns.  If NetBSD users won't be typing
"df -P" regularly to produce human readable output then I don't see any
point to doing column alignment in "df -P", even if this does lead to a
naively implemented native NetBSD application that uses "df -P | cut"
not being immediately portable to the likes of SunOS-5.

(obviously if NetBSD's "df -P" doesn't do column alignment then it will
certainly discourage users from using it for human readable output, so
I'm not sure if that's putting the cart before the horse or not :-)

-- 
								Greg A. Woods

+1 416 218-0098;            <g.a.woods@ieee.org>;           <woods@robohack.ca>
Planix, Inc. <woods@planix.com>; VE3TCP; Secrets of the Weird <woods@weird.com>