summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2012-03-27 23:43:46 -0400
committerDan McGee <dan@archlinux.org>2012-03-28 09:56:11 -0500
commit7f258619c6c0e9f441aacbabfc1a2f5980c5cb9b (patch)
tree974c6d08d39039131540b611f858aad229a16167
parentbe0e0444040dc7d84e86c5b5e60b786441c4d97e (diff)
downloadpacman-7f258619c6c0e9f441aacbabfc1a2f5980c5cb9b.tar.xz
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 <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--scripts/makepkg.sh.in6
1 files changed, 6 insertions, 0 deletions
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 ))"