bug-coreutils
[Top][All Lists]
Advanced

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

Possible bug.


From: Harley D. Eades III
Subject: Possible bug.
Date: 16 Jan 2005 09:14:36 -0600
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Hello,
        While creating a file to use for debugging parted I used
the command `head -c 10m /dev/zero > ./gnu' then used `ls -sh ./gnu' to confirm
the 10m file was created and noticed ls reported it as 11m.  Confused, I 
issued `head -c 11m /dev/zero > test && ls -sh ./test' and ls -sh reported
test as 12m.  Still confused I issued another this time below 10m
`head -c 5m /dev/zero > test && ls -sh ./test' and ls -sh reported it as 5.1, 
interesting.  I had a with talk Alfred Szmidt and he recommend me to report 
it.

This was all done under Debian GNU/Hurd.
hurd:~# ls --version
ls (coreutils) 5.2.1
Written by Richard Stallman and David MacKenzie.

Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

>From `info ls':
 `-h'
 `--human-readable'
      Append a size letter to each size, such as `M' for mebibytes.
      Powers of 1024 are used, not 1000; `M' stands for 1,048,576 bytes.
      Use the `--si' option if you prefer powers of 1000.

There is a typo in `info ls' as you can see above mebibytes, should that be
megabytes?

hurd:~# head --version
head (coreutils) 5.2.1
Written by David MacKenzie and Jim Meyering.

Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

>From `info head':
`-c N'
 `--bytes=N'
      Print the first N bytes, instead of initial lines.  Appending `b'
     multiplies N by 512, `k' by 1024, and `m' by 1048576.  However, if
     N starts with a `-', print all but the last N bytes of each file.

So 10m is 10*1048576

Test:
/bin/head -c 1m /dev/zero > test
/bin/ls -sh ./test
1.1M ./test
/bin/head -c 2m /dev/zero > test
/bin/ls -sh ./test
2.1M ./test
/bin/head -c 3m /dev/zero > test
/bin/ls -sh ./test
3.1M ./test
/bin/head -c 4m /dev/zero > test
/bin/ls -sh ./test
4.1M ./test
/bin/head -c 5m /dev/zero > test
/bin/ls -sh ./test
5.1M ./test
/bin/head -c 6m /dev/zero > test
/bin/ls -sh ./test
6.1M ./test
/bin/head -c 7m /dev/zero > test
/bin/ls -sh ./test
7.1M ./test
/bin/head -c 8m /dev/zero > test
/bin/ls -sh ./test
8.1M ./test
/bin/head -c 9m /dev/zero > test
/bin/ls -sh ./test
9.1M ./test
/bin/head -c 10m /dev/zero > test
/bin/ls -sh ./test
11M ./test
/bin/head -c 11m /dev/zero > test
/bin/ls -sh ./test
12M ./test
/bin/head -c 12m /dev/zero > test
/bin/ls -sh ./test
13M ./test
/bin/head -c 13m /dev/zero > test
/bin/ls -sh ./test
14M ./test
/bin/head -c 14m /dev/zero > test
/bin/ls -sh ./test
15M ./test
/bin/head -c 15m /dev/zero > test
/bin/ls -sh ./test
16M ./test
/bin/head -c 16m /dev/zero > test
/bin/ls -sh ./test
17M ./test
/bin/head -c 17m /dev/zero > test
/bin/ls -sh ./test
18M ./test
/bin/head -c 18m /dev/zero > test
/bin/ls -sh ./test
19M ./test
/bin/head -c 19m /dev/zero > test
/bin/ls -sh ./test
20M ./test
/bin/head -c 20m /dev/zero > test
/bin/ls -sh ./test
21M ./test
END TEST:

As you can see everything below 10m is X+0.1 meg and everything above 10m is 
X+1 meg, this does not seem correct.


Thanks
Harley D. Eades III

P.S If all replies could be CC'd to address@hidden I would appreciate it.
I am currently not a member of this list.





reply via email to

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