Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Dec 2017 22:57:59 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 224498] ls -lh does not display properly around 1MB, 1GB, ...
Message-ID:  <bug-224498-8-8dE6vVTm0f@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-224498-8@https.bugs.freebsd.org/bugzilla/>
References:  <bug-224498-8@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D224498

--- Comment #5 from commit-hook@freebsd.org ---
A commit references this bug:

Author: robak
Date: Thu Dec 28 22:57:35 UTC 2017
New revision: 327317
URL: https://svnweb.freebsd.org/changeset/base/327317

Log:
  humanize_number(3): fix math edge case in rounding large numbers

  Fix for remainder overflow, when in rare cases adding remainder to divider
  exceeded 1 and turned the total to 1000 in final formatting, taking up
  the space for the unit character.

  The fix continues the division of the original number if the above case
  happens -- added the appropriate check to the for loop performing
  the division. This lowers the value shown, to make it fit into the buffer
  space provided (1.0M for 4+1 character buffer, as used by ls).

  Add test case for the reported bug and extend test program to support
  providing buffer length (ls -lh uses 5, tests hard-coded 4).

  PR:           224498
  Submitted by: Pawel Biernacki <pawel.biernacki@gmail.com>
  Reported by:  Masachika Ishizuka <ish@amail.plala.or.jp>
  Reviewed by:  cem, kib
  Approved by:  cem, kib
  MFC after:    1 week
  Sponsored by: Mysterious Code Ltd.
  Differential Revision:        D13578

Changes:
  head/lib/libutil/humanize_number.3
  head/lib/libutil/humanize_number.c
  head/lib/libutil/tests/humanize_number_test.c

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-224498-8-8dE6vVTm0f>