Bug 2896

Summary: busybox: du-k-works test case failed
Product: [Build System, Metadata & Runtime] OE-Core Reporter: LiRongQing <rongqing.li>
Component: coreAssignee: Kai Kang <kai.kang>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: alexandrux.palalau, jessica.zhang, kai.kang, liang.li2, meta.mr.watcher, meta.watcher, zhenfeng.zhao
Version: 1.3   
Target Milestone: 1.4 M2   
Hardware: x86   
OS: Multiple   
Whiteboard: (P2)(D5)(Merged)
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: ---

Description LiRongQing 2012-08-06 01:39:16 UTC
The du-k-works test seems to assume that du -k on a directory with two files
totaling 80 kilobytes should report either 80k or 88k. In ext4 filesystm however,
both busybox' du -k and coreutils' du -k reports a size of 84k which causes the
test to fail.

=>du-k-works
FAIL: du-k-works
+ mkdir du.testdir
+ cd du.testdir
+ dd if=/dev/zero of=file1 bs=1k count=64
+ dd if=/dev/zero of=file2 bs=1k count=16
++ busybox du -k .
++ busybox du -k .
+ test 'x84    .' = 'x80    .' -o 'x84    .' = 'x88    .'
Comment 2 Alexandru Palalau 2012-08-29 13:42:55 UTC
I have built the ext3 and ext4 images for the Qemux86 machine, core-image-minimal.
Followed the steps presented below and got the following output:
EXT4: file1 = 64k
      file2 = 16k
busybox du -k . command returns 81

EXT3: file1 = 64k
      file2 = 16k
busybox du -k . command returns 83
Comment 3 Kai Kang 2013-01-15 10:29:11 UTC
This is problem of the test case itself. 
It expect a directory occupies 0 or 8 kb which is the "block size" of file system. But when create a ext3/4 file system,  mke2fs will use heuristics to determine the appropriate block size if '-b' is not provided. When the size of partition less than 512MB, the "block size" is 1024. That why the result of "busybox du -k ." is 81.

We can 
1 run mkfs.ext3/4 with "-b 4096"  or "-b 8192", or
2 run this case on a partition which larger than 512M to make test case pass after the patch merged(and the patch is merged to busybox git repo).
Comment 4 Kai Kang 2013-02-01 02:00:28 UTC
Patch merged by busybox upstream, then backport it.
Comment 5 liang li 2013-02-05 09:19:57 UTC
no error with git master branch commit 7e9cb437b1b720e656f4a33f73c07c5dc7356a2c.