Bug 12235

Summary: image.bbclass: Consider adding --apparent-size to du -ks for get_rootfs_size
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Jonathan Liu <net147>
Component: deploymentAssignee: Maxin B. John <maxin.john>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: Medium+ CC: randy.macleod, ross.burton
Version: 5.99   
Target Milestone: 2.5 M1   
Hardware: All   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Jonathan Liu 2017-10-18 12:43:16 UTC
Consider changing du -ks to du --apparent-size -ks for more reproducible builds. I get slightly different results running du -ks on a btrfs filesystem with compress-force=lzo compared to an ext4 filesystem.

btrfs:
$ wget http://www.tpg.com.au/test3.iso
$ du --apparent-size -ks test3.iso
51102   test3.iso
$ du -ks test3.iso
51104   test3.iso

ext4:
$ wget http://www.tpg.com.au/test3.iso
$ du --apparent-size -ks test3.iso
51102   test3.iso
$ du -ks test3.iso
51108   test3.iso
Comment 1 Ross Burton 2017-10-19 14:44:55 UTC
As we're getting the size of a single file, we could just use stat() right?
Comment 2 Jonathan Liu 2017-10-19 22:14:53 UTC
(In reply to comment #1)
> As we're getting the size of a single file, we could just use stat() right?

It is calculating size for a directory not a single file.
Comment 3 Ross Burton 2017-10-20 07:50:45 UTC
Yes, sorry, I was thinking of the wrong variable.

Note that you'll still get differences with --apparent-size thanks to the directory inodes being of variable size.
Comment 5 Ross Burton 2018-01-11 15:54:40 UTC
Duplicate so marking as such.

*** This bug has been marked as a duplicate of bug 8430 ***