From owner-freebsd-pkg@freebsd.org Wed Feb 27 22:25:37 2019 Return-Path: Delivered-To: freebsd-pkg@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 05CE81507338 for ; Wed, 27 Feb 2019 22:25:37 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 7143593743 for ; Wed, 27 Feb 2019 22:25:36 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: by mailman.ysv.freebsd.org (Postfix) id 2AE2E1507334; Wed, 27 Feb 2019 22:25:36 +0000 (UTC) Delivered-To: pkg@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 053CF1507331 for ; Wed, 27 Feb 2019 22:25:36 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.ysv.freebsd.org (mxrelay.ysv.freebsd.org [IPv6:2001:1900:2254:206a::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.ysv.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8137F9373F for ; Wed, 27 Feb 2019 22:25:35 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.ysv.freebsd.org (Postfix) with ESMTPS id A318DFC7D for ; Wed, 27 Feb 2019 22:25:34 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id x1RMPYeW005134 for ; Wed, 27 Feb 2019 22:25:34 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id x1RMPYwo005133 for pkg@FreeBSD.org; Wed, 27 Feb 2019 22:25:34 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" From: bugzilla-noreply@freebsd.org To: pkg@FreeBSD.org Subject: maintainer-feedback requested: [Bug 236093] ports-mgmt/pkg: possible error in function format_rate_SI (src/event.c) Date: Wed, 27 Feb 2019 22:25:34 +0000 X-Bugzilla-Type: request X-Bugzilla-Product: Ports & Packages X-Bugzilla-Component: Individual Port(s) X-Bugzilla-Version: Latest X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: pkg@FreeBSD.org X-Bugzilla-Flags: maintainer-feedback? Message-ID: In-Reply-To: References: X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-pkg@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binary package management and package tools discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Feb 2019 22:25:37 -0000 Bugzilla Automation has asked freebsd-pkg mailing li= st for maintainer-feedback: Bug 236093: ports-mgmt/pkg: possible error in function format_rate_SI (src/event.c) https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D236093 --- Description --- src/event.c: 87 /* units for format_size */=09=09=09=09=09=09=20=20=20=20=20=20=20 88 static const char *unit_SI[] =3D { " ", "k", "M", "G", "T", }; 109 static void=20=09=09=09=09=09=09=09=20=20=20=20=20=20=20 110 format_rate_SI(char *buf, int size, off_t bytes)=09=09=09=20=20=20=20= =20=20=20 111 {=09=09=09=09=09=09=09=09=09=20=20=20=20=20=20=20 112 int i;=09=09=09=09=09=09=09=20=20=20=20=20=20=20 113=09=09=09=09=09=09=09=09=09=20=20=20=20=20=20=20 114 bytes *=3D 100;=09=09=09=09=09=09=20=20=20=20=20=20=20 115 for (i =3D 0; bytes >=3D 100*1000 && unit_SI[i][0] !=3D 'T'; i++)= =20=20=20=20=20=20=20=20 116 bytes =3D (bytes + 500) / 1000;=09=09=09=20=20=20=20=20=20=20 117 if (i =3D=3D 0) {=09=09=09=09=09=09=20=20=20=20=20=20=20 118 i++;=09=09=09=09=09=09=20=20=20=20=20=20=20 119 bytes =3D (bytes + 500) / 1000;=09=09=09=20=20=20=20=20=20=20 120 }=09=09=09=09=09=09=09=09=20=20=20=20=20=20=20 121 snprintf(buf, size, "%3lld.%1lld%s%s",=09=09=09=20=20=20=20=20=20=20 122 (long long) (bytes + 5) / 100,=09=09=09=09=20=20=20=20=20=20=20 123 (long long) (bytes + 5) / 10 % 10,=09=09=09=20=20=20=20=20=20=20 124 unit_SI[i],=09=09=09=09=09=09=20=20=20=20=20=20=20 125 i ? "B" : " ");=20=09=09=09=09=09=20=20=20=20=20=20=20 126 } Unless I am mistaken, i can not be zero at lines 124-125. As a consequence: =E2=80=A2 the first element of unit_SI is never used =E2=80=A2 in the call to snprintf, the last argument is always "B", never "= "