home *** CD-ROM | disk | FTP | other *** search
- Submitted-by: ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe)
-
- > >The current draft of the POSIX user portability extensions spec says
- > >that df and du should give sizes in units of 512 bytes. I have found
- > >this behavior confusing and inconvenient; I suspect others do too.
-
- To be perfectly frank, it seems to _me_ that (since UNIX files are
- logically sequences of bytes, not sequences of blocks, or records, or bits)
- that there is precisely ONE ``natural unit'' for reporting ALL file-related
- sizes, and that is bytes.
-
- I suggest that it is possible BOTH to make things simple and consistent for
- users AND to be POSIX-compliant. Have an environment variable
- BLOCK_UNIT=1 # for me
- BLOCK_UNIT=512 # for 512ists
- BLOCK_UNIT=1024 # for 1024ists
- # no assignment # for people who want POSIX behaviour
- What about the name to be displayed for the units? bytes/blocks/k/whatever.
- Ideally, that would be ``locale''-specific. A simple approach would just be
- to display
- Filesystem size/512 used avail capacity Mounted on
- ^^^^^^^^
- where the indicated phrase replaces "kbytes", and has the form
- size/${BLOCK_UNIT-1024}. What price a "-k" option? You wouldn't need it.
- Just use
- BLOCK_UNIT=1024 df
-
- Doing it by making the block unit the value of an environment variable
- - clutters up the environment with another variable (I firmly believe
- that any program which uses more than one environment variable --
- the name of a file with other options -- is badly written)
-
- + but at least it's way better than POSIX_ME_HARDER, which is about as
- obscure as it can be
-
- + makes it easy for user-written utilities to follow the SAME convention
- (and the same way of over-riding it in the command line)
-
- - requires one more step when installing a system, setting up the
- default value (IF an installation wants non-POSIX behaviour)
-
- + makes it easy for an installation to configure the default in
- the default .cshrc / .profile files
-
- + provides a natural way of figuring out how to display the units
-
- Of course, the Right Answer is that 'df' should be a relation, not a
- program, and df itself should be a trivial AWK script on top of that.
- But we can't have all our druthers, can we?
- --
- It really is a nice theory. The only defect I think it has is probably
- common to all philosophical theories. It's wrong. -- Saul Kripke.
- I'm ok@goanna.cs.rmit.oz.au; all donations accepted.
-
-
- Volume-Number: Volume 24, Number 98
-
-