Subject: Re: CVS commit: src/bin/ls
To: None <source-changes@NetBSD.org>
From: Alan Barrett <apb@cequrux.com>
List: source-changes
Date: 10/24/2005 10:51:10
On Mon, 24 Oct 2005, Martin S. Weber wrote:
> > > Log Message:
> > > document that -h makes -l suppress -s.
> > > (Ie 'ls -lhs' == 'ls -lh')
> > 
> > erm why does -h kill -s ?
> 
> I think because -h supposes BLOCKSIZE=1 so to speak, while -s
> uses BLOCKSIZE=$BLOCKSIZE. So (to me) they're either exclusive
> flags, or there's a need for a 2nd size display - one displaying
> the 'humanized' number of 'bytes' and the other one displaying..
> what ? 'humanized' number of 'blocks' (not sure 1.2M isn't too
> misleading there), or plain number of blocks ?

To me, the important characteristic of "ls -s" is that it displays
the amount of space actually used, as opposed to the logical file size.

	$ echo foo | dd of=foo bs=1 seek=20m
	4+0 records in
	4+0 records out
	4 bytes transferred in 0.001 secs (4000 bytes/sec)
	$ ls -ls foo
	96 -rw-r-----  1 apb  apb  20971524 Oct 24 10:42 foo

The 96 blocks translates to 44032 bytes, or 43 kB.  I would expect
output like this from "ls -lsh":

	43k -rw-r-----  1 apb  apb  20M Oct 24 10:42 foo

--apb (Alan Barrett)