~alpine/devel

abuild: avoid division by zero when calculating human size for packages v1 PROPOSED

Christian Kampka: 1
 abuild: avoid division by zero when calculating human size for packages

 1 files changed, 6 insertions(+), 3 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.alpinelinux.org/~alpine/devel/patches/963/mbox | git am -3
Learn more about email & git

[alpine-devel] [PATCH] abuild: avoid division by zero when calculating human size for packages Export this patch

---
 abuild.in | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/abuild.in b/abuild.in
index 3b6fe04..2642fdf 100644
--- a/abuild.in
+++ b/abuild.in
@@ -1253,8 +1253,12 @@ scan_pkgconfig_depends() {
# read size in bytes from stdin and show as human readable
human_size() {
	awk '{  split("B KB MB GB TB PB", type)
		for(i=5; y < 1; i--)
			y = $1 / (2**(10*i))
		if($1 == 0)
			# avoid division by zero
			y = 0
		else
			for(i=5; y < 1; i--)
				y = $1 / (2**(10*i))
		printf("%.1f %s\n", y, type[i+2]) }'
}

@@ -2209,4 +2213,3 @@ for i in $install_after; do
done

cleanup

-- 
2.6.1



---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---