bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: df & du should honor $BLOCKSIZE


From: Paul Eggert
Subject: Re: df & du should honor $BLOCKSIZE
Date: 22 Feb 2004 21:35:24 -0800
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

address@hidden (Peter Seebach) writes:

> In message <address@hidden>, Jim Meyering writes:
> >address@hidden (Peter Seebach) wrote:
> >...
> >> This seems wrong.  The user setting $BLOCKSIZE presumably intends it to
> >
> >If you spell it `BLOCK_SIZE', then it should work.
> 
> Hmm.  When did this spelling change?

On 1998-06-29.  But the only use of BLOCKSIZE before then was
BLOCKSIZE='HUMAN' and BLOCKSIZE='SI'; no other values were supported,
and that old usage (which itself was introduced in two changes:
1996-01-20 and 1997-11-30) wasn't described in the texinfo documention
and wasn't consistent with the --block-size long option.

As the 1998 change caused the environment variable to have the same
interpretation as the "--block-size" long option, I thought it more
consistent at the time to spell the environment variable "BLOCK_SIZE"
rather than "BLOCKSIZE".

> It seems to me like it would be reasonable to use $BLOCKSIZE if
> $BLOCK_SIZE isn't set, simply because it's widely used elsewhere.

Something like that sounds reasonable, except what is BLOCKSIZE
supposed to mean when it's widely used elsewhere?  Do you have a
specification somewhere?  I couldn't find one.  I did notice behavior
quirks, though.  For example:

openbsd-3.2$ BLOCKSIZE=1048576 df .
Filesystem       1048576-blocks     Used    Avail Capacity  Mounted on
sic:/export/ford          17239     9695     7371    57%    /whatever

coreutils-5.2.0$ BLOCK_SIZE=1048576 df .
Filesystem           1M-blocks      Used Available Use% Mounted on
sic:/export/ford         17240      9696      7372  57% /whatever

Note that the BSD "df" says "1048576-blocks" whereas the coreutils
"df" says "1M-blocks".  (There are some rounding inconsistencies,
too.)


While we're on the subject, it appears to me that there is a bug in
how du/df/ls etc. treat invalid environment-value settings.  For example:

$ ls -ld 
drwxr-xr-x  40 eggert eggert 4096 2004-02-22 20:17 .
$ BLOCK_SIZE=ridiculous ls -ld
drwxr-xr-x  40 eggert eggert 4 2004-02-22 20:17 .

It seems to me that "ls" etc. should ignore ridiculous settings like
that, instead of having them be equivalent to BLOCK_SIZE=1024.  Does
that sound right to you?  If so, I can prepare a patch.  (But this
might be related to the issue of what BLOCKSIZE actually means on
those other platforms.)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]