bug#7042: df --help does not show `-m' option

2010-09-17 Thread Pádraig Brady
On 16/09/10 23:34, Paul Eggert wrote:
 On 09/16/10 11:21, Eric Blake wrote:
 document -m, with --block-size=M as the long-option spelling
 add -g, with --block-size=G as the long-option spelling
 
 This doesn't sound like a good idea.  Multi-terabyte disks
 are already here, and df -t is already taken.  Also,
 df -g already means something different in Solaris.
 
 Is it really that hard to type df -Bg?

Yes I agree the current unit selection options are fine.

 If we're going to make incompatible changes, I suggest that
 we solve the problem once and for all, by having df choose
 the default blocksize dynamically, based on the size of the
 output line describing the smallest disk.  For example, where
 df currently outputs this:
 
 Filesystem   1K-blocks  Used Available Use% Mounted on
 /dev/sda111620338002   1437021 11618900981   1% /r/opt
 /dev/sda2 20971520   1335871  19635650   7% /home/eggert
 
 df would notice that the smallest file system is between 1GB and 1TB,
 so it would default to 1 GB blocks, as follows:
 
 Filesystem  1GB-blocks  Used Available Use% Mounted on
 /dev/sda1  11900GB   2GB   11898GB   1% /r/opt
 /dev/sda2 22GB   2GB  21GB   7% /home/eggert
 
 This is much more useful as an output format, because one can visually
 see which file systems are larger by seeing how many digits are there.
 Contrast this to the output of df --si:
 
 Filesystem Size   Used  Avail Use% Mounted on
 /dev/sda1   12T   1.5G12T   1% /r/opt
 /dev/sda2   22G   1.4G21G   7% /home/eggert
 
 which is harder to visually parse that way.

That would break lots of scripts I'd say
(they should use -P, but many don't).
In any case I don't think there is enough benefit
in such a format change given the common wide range
of device sizes attached to systems.
Personally I find the `df -h` format easiest to read.

 While we're at it, we should fix df so that its columns line up better;
 that would be another incompatible change, but it'd be worth it
 on hosts where the file system names are long.

We definitely should do this to support languages
with side column headings, and `df -B\'1`
I've an unfinished local branch to do this with mbsalign()

cheers,
Pádraig.





bug#7042: df --help does not show `-m' option

2010-09-17 Thread Erik Auerswald
Hi,

On Fri, Sep 17, 2010 at 09:56:57AM +0100, Pádraig Brady wrote:
 On 16/09/10 23:34, Paul Eggert wrote:
  If we're going to make incompatible changes, I suggest that
  we solve the problem once and for all, by having df choose
  the default blocksize dynamically, based on the size of the
  output line describing the smallest disk.  For example, where
  df currently outputs this:
  
  Filesystem   1K-blocks  Used Available Use% Mounted on
  /dev/sda111620338002   1437021 11618900981   1% /r/opt
  /dev/sda2 20971520   1335871  19635650   7% /home/eggert
  
  df would notice that the smallest file system is between 1GB and 1TB,
  so it would default to 1 GB blocks, as follows:
  
  Filesystem  1GB-blocks  Used Available Use% Mounted on
  /dev/sda1  11900GB   2GB   11898GB   1% /r/opt
  /dev/sda2 22GB   2GB  21GB   7% /home/eggert
  
  This is much more useful as an output format, because one can visually
  see which file systems are larger by seeing how many digits are there.
  Contrast this to the output of df --si:
  
  Filesystem Size   Used  Avail Use% Mounted on
  /dev/sda1   12T   1.5G12T   1% /r/opt
  /dev/sda2   22G   1.4G21G   7% /home/eggert
  
  which is harder to visually parse that way.

Yes, especially 1.5G of the 12T disk used looks a lot like 1.5T of 1.5T
used.

 That would break lots of scripts I'd say
 (they should use -P, but many don't).

That's obvious (all three points, sadly).

 In any case I don't think there is enough benefit
 in such a format change given the common wide range
 of device sizes attached to systems.

I like Paul's suggestion. Of course there are corner cases (mounting an
older USB stick with e.g. 128MB). The base could be selected by the
smallest mounted fixed disk.

Erik
-- 
[T]he essence of XML is this: the problem it solves is not hard,
and it does not solve the problem well.
-- The Essence of XML by Jérôme Siméon, Philip Wadler





bug#7042: df --help does not show `-m' option

2010-09-17 Thread Andreas Schwab
Pádraig Brady p...@draigbrady.com writes:

 On 16/09/10 23:34, Paul Eggert wrote:
 If we're going to make incompatible changes, I suggest that
 we solve the problem once and for all, by having df choose
 the default blocksize dynamically, based on the size of the
 output line describing the smallest disk.  For example, where
 df currently outputs this:
 
 Filesystem   1K-blocks  Used Available Use% Mounted on
 /dev/sda111620338002   1437021 11618900981   1% /r/opt
 /dev/sda2 20971520   1335871  19635650   7% /home/eggert
 
 df would notice that the smallest file system is between 1GB and 1TB,
 so it would default to 1 GB blocks, as follows:
 
 Filesystem  1GB-blocks  Used Available Use% Mounted on
 /dev/sda1  11900GB   2GB   11898GB   1% /r/opt
 /dev/sda2 22GB   2GB  21GB   7% /home/eggert
 

 That would break lots of scripts I'd say
 (they should use -P, but many don't).

You could use `df -Bauto' for that.

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
And now for something completely different.





bug#7042: df --help does not show `-m' option

2010-09-16 Thread Eric Blake

On 09/16/2010 09:20 AM, Pádraig Brady wrote:

On 16/09/10 12:59, Petr Pisar wrote:

Hello,

I found `df' utility from coreutils-8.5 does not describe `-m' option that is
mentioned in info page and the program accepts it.

-- Petr


-m was deprecated in 2001
http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=commit;h=d1772031

It is not mentioned in the info page as far as I can see
It's not specified by POSIX
It's not used in solaris
It _is_ used in FreeBSD


Oh - I only tested MirBSD (which is more like OpenBSD).



So this is much the same argument as supporting `dd bs=1m`
http://lists.gnu.org/archive/html/coreutils/2010-09/msg00028.html

Also there was a previous request for `df -g` and `du -g`
http://lists.gnu.org/archive/html/bug-coreutils/2009-12/msg0.html


Yeah, the 'existing implementation' argument does carry some weight 
(then again, witness my patch today to nuke 'rm -d' even though that was 
also based on the 'existing implementation' argument).




The only reason one would support these is for compat with FreeBSD,
and if we did, we wouldn't want to promote their use through documentation.


Or, maybe what we should do is:

now:
make 'du--megabytes' issue a warning (it is the wrong word for what it 
does).

document -m, with --block-size=M as the long-option spelling
add -g, with --block-size=G as the long-option spelling

in a few years:
remove 'du --megabytes' altogether

--
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org





bug#7042: df --help does not show `-m' option

2010-09-16 Thread Paul Eggert
On 09/16/10 11:21, Eric Blake wrote:
 document -m, with --block-size=M as the long-option spelling
 add -g, with --block-size=G as the long-option spelling

This doesn't sound like a good idea.  Multi-terabyte disks
are already here, and df -t is already taken.  Also,
df -g already means something different in Solaris.

Is it really that hard to type df -Bg?

If we're going to make incompatible changes, I suggest that
we solve the problem once and for all, by having df choose
the default blocksize dynamically, based on the size of the
output line describing the smallest disk.  For example, where
df currently outputs this:

Filesystem   1K-blocks  Used Available Use% Mounted on
/dev/sda111620338002   1437021 11618900981   1% /r/opt
/dev/sda2 20971520   1335871  19635650   7% /home/eggert

df would notice that the smallest file system is between 1GB and 1TB,
so it would default to 1 GB blocks, as follows:

Filesystem  1GB-blocks  Used Available Use% Mounted on
/dev/sda1  11900GB   2GB   11898GB   1% /r/opt
/dev/sda2 22GB   2GB  21GB   7% /home/eggert

This is much more useful as an output format, because one can visually
see which file systems are larger by seeing how many digits are there.
Contrast this to the output of df --si:

Filesystem Size   Used  Avail Use% Mounted on
/dev/sda1   12T   1.5G12T   1% /r/opt
/dev/sda2   22G   1.4G21G   7% /home/eggert

which is harder to visually parse that way.

While we're at it, we should fix df so that its columns line up better;
that would be another incompatible change, but it'd be worth it
on hosts where the file system names are long.