X-Original-To: alpine-devel@mail.alpinelinux.org Delivered-To: alpine-devel@mail.alpinelinux.org Received: from mail.alpinelinux.org (dallas-a1.alpinelinux.org [127.0.0.1]) by mail.alpinelinux.org (Postfix) with ESMTP id 58D64DCB8C8 for ; Sat, 17 Oct 2015 13:50:13 +0000 (UTC) Received: from mail-wi0-f176.google.com (mail-wi0-f176.google.com [209.85.212.176]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mail.alpinelinux.org (Postfix) with ESMTPS id EBE4BDC933D for ; Sat, 17 Oct 2015 13:50:11 +0000 (UTC) Received: by wijp11 with SMTP id p11so43992625wij.0 for ; Sat, 17 Oct 2015 06:50:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=p/ERqf1MI0EtX03p/dc/NKQ+o1qPusQln+Bj0vWE5Vc=; b=gzYlW+XpttbrsSIAA4ObFYUVR/6VGy66CNRO4s/cx5+Tz2FQO5L2HMpSn1P0lG7Ose CZPh6lZQ6t7Vj22VPpRraOeQeQhbk80wSQWs85WHa5B0kj8l01DBB5v8brRDbriOvuDz X0xiFv2hETvGmBbEN3sN3NGFG5ipaH+OpUSeK17YdYVzmtkquL0bzT7C5IgCR+Q53heK 2k3FVB1nytDgkCBn6nCUTPGX+z4xSqjMfVe3y//qfKth2lUsy2VrVvP/cKPcPHazPw+a 7BNJd8ludBDGGsyj8v6nlx/7EHJSaNu2KzHOFg4KkQhqn7Bo4BZw7GUjLKyilevfLyM+ sNow== X-Gm-Message-State: ALoCoQmvm5DBVPoMKorSARP07uvkQQvJbmuxdj21HF2D9Owk2LeuTcsVpagWYiaRQyWpakGR/2QQ X-Received: by 10.194.20.68 with SMTP id l4mr25635161wje.24.1445089809635; Sat, 17 Oct 2015 06:50:09 -0700 (PDT) Received: from localhost (pD95787FB.dip0.t-ipconnect.de. [217.87.135.251]) by smtp.gmail.com with ESMTPSA id lv4sm28503262wjb.43.2015.10.17.06.50.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 17 Oct 2015 06:50:08 -0700 (PDT) From: Christian Kampka To: alpine-devel@lists.alpinelinux.org Cc: Christian Kampka Subject: [alpine-devel] [PATCH] abuild: avoid division by zero when calculating human size for packages Date: Sat, 17 Oct 2015 15:49:58 +0200 Message-Id: <1445089798-14998-1-git-send-email-christian@kampka.net> X-Mailer: git-send-email 2.6.1 X-Virus-Scanned: ClamAV using ClamSMTP X-Mailinglist: alpine-devel Precedence: list List-Id: Alpine Development List-Unsubscribe: List-Post: List-Help: List-Subscribe: --- 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 ---