From 7f258619c6c0e9f441aacbabfc1a2f5980c5cb9b Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Tue, 27 Mar 2012 23:43:46 -0400 Subject: makepkg: avoid reporting bogus install size on btrfs delayed allocation hoses us here and causes erroenous install sizes to be reported. Add a short sleep to allow the transaction to be committed to the filesystem and the stat buffers to be updated. This is apparently a "feature", as per to some of the denizens of #btrfs on freenode. Signed-off-by: Dave Reisner Signed-off-by: Dan McGee --- scripts/makepkg.sh.in | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 2d672a37..1faf591f 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1120,6 +1120,12 @@ write_pkginfo() { else local packager="Unknown Packager" fi + + # btrfs's delayed allocation causes the stat buffers from the kernel to "lie" + # to us momentarily and report 0 blocks allocated (which is how du calculates + # size). Sleeping for a second here is about the dirtiest thing possible, + # but avoids reporting entirely bogus install sizes. + sleep 1 local size="$(@DUPATH@ -sk)" size="$(( ${size%%[^0-9]*} * 1024 ))" -- cgit v1.2.3-70-g09d2