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 ))"