home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / std_unix / volume.24 / text0097.txt < prev    next >
Encoding:
Text File  |  1991-09-03  |  2.4 KB  |  58 lines

  1. Submitted-by: ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe)
  2.  
  3. > >The current draft of the POSIX user portability extensions spec says
  4. > >that df and du should give sizes in units of 512 bytes.  I have found
  5. > >this behavior confusing and inconvenient; I suspect others do too.
  6.  
  7. To be perfectly frank, it seems to _me_ that (since UNIX files are
  8. logically sequences of bytes, not sequences of blocks, or records, or bits)
  9. that there is precisely ONE ``natural unit'' for reporting ALL file-related
  10. sizes, and that is bytes.
  11.  
  12. I suggest that it is possible BOTH to make things simple and consistent for
  13. users AND to be POSIX-compliant.  Have an environment variable
  14.     BLOCK_UNIT=1        # for me
  15.     BLOCK_UNIT=512        # for 512ists
  16.     BLOCK_UNIT=1024        # for 1024ists
  17.     # no assignment        # for people who want POSIX behaviour
  18. What about the name to be displayed for the units?  bytes/blocks/k/whatever.
  19. Ideally, that would be ``locale''-specific.  A simple approach would just be
  20. to display
  21. Filesystem          size/512    used   avail capacity  Mounted on
  22.             ^^^^^^^^
  23. where the indicated phrase replaces "kbytes", and has the form
  24. size/${BLOCK_UNIT-1024}.  What price a "-k" option?  You wouldn't need it.
  25. Just use
  26.     BLOCK_UNIT=1024 df
  27.  
  28. Doing it by making the block unit the value of an environment variable
  29.     - clutters up the environment with another variable (I firmly believe
  30.       that any program which uses more than one environment variable --
  31.       the name of a file with other options -- is badly written)
  32.  
  33.     + but at least it's way better than POSIX_ME_HARDER, which is about as
  34.       obscure as it can be
  35.  
  36.     + makes it easy for user-written utilities to follow the SAME convention
  37.       (and the same way of over-riding it in the command line)
  38.  
  39.     - requires one more step when installing a system, setting up the
  40.       default value (IF an installation wants non-POSIX behaviour)
  41.  
  42.     + makes it easy for an installation to configure the default in
  43.       the default .cshrc / .profile files
  44.  
  45.     + provides a natural way of figuring out how to display the units
  46.  
  47. Of course, the Right Answer is that 'df' should be a relation, not a
  48. program, and df itself should be a trivial AWK script on top of that.
  49. But we can't have all our druthers, can we?
  50. -- 
  51. It really is a nice theory.  The only defect I think it has is probably
  52. common to all philosophical theories.  It's wrong.      -- Saul Kripke.
  53. I'm ok@goanna.cs.rmit.oz.au; all donations accepted.
  54.  
  55.  
  56. Volume-Number: Volume 24, Number 98
  57.  
  58.