Date: Tue, 31 Aug 2010 15:06:39 GMT From: pluknet <pluknet@gmail.com> To: freebsd-gnats-submit@FreeBSD.org Subject: bin/150151: [patch] fix quota(1) output [regression] Message-ID: <201008311506.o7VF6dHI079125@www.freebsd.org> Resent-Message-ID: <201008311510.o7VFA4FJ026757@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 150151 >Category: bin >Synopsis: [patch] fix quota(1) output [regression] >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Aug 31 15:10:04 UTC 2010 >Closed-Date: >Last-Modified: >Originator: pluknet >Release: 9-CURRENT as of August '10 >Organization: >Environment: FreeBSD 9.0-CURRENT #47: Mon Aug 30 15:58:57 UTC 2010 root@host:/usr/obj/usr/src/sys/CUST amd64 >Description: After quota64 project merge, quota(1) starts to 1) incorrectly format numbers in -h mode; 2) print incorrect numbers in ordinary (non -h) mode. The causing changes is in: 1) field expansion resulting in passing too large buffer size to humanize_number(3); 2) some reason resulting in incorrect use of {dbtob() and multiplying} for calculating 1024-k sized blocks from disk blocks. >How-To-Repeat: # quota -rg nobody Raw group quota information for id 65534 on /mnt block hard limit: 0 block soft limit: 400000 current block count: 8 i-node hard limit: 0 i-node soft limit: 0 current i-node count: 1 block grace time: 1283866029 Tue Sep 7 13:27:09 2010 i-node grace time: 1283861167 Tue Sep 7 12:06:07 2010 Incorrect output: # quota -gh nobody Disk quotas for group nobody (gid 65534): Filesystem usage quota limit grace files quota limit grace /mnt 4096B 200000K 0B 1 0 0 # quota -g nobody Disk quotas for group nobody (gid 65534): Filesystem usage quota limit grace files quota limit grace /mnt 4194304 209715200000 0 1 0 0 >Fix: The possible and least intrusive change in attach. It mostly reverts a some part of quota64 project. Output after patching: # quota -gh nobody Disk quotas for group nobody (gid 65534): Filesystem usage quota limit grace files quota limit grace /mnt 4.0K 195M 0B 1 0 0 # quota -g nobody Disk quotas for group nobody (gid 65534): Filesystem usage quota limit grace files quota limit grace /mnt 4 200000 0 1 0 0 Patch attached with submission follows: Index: quota.c =================================================================== --- quota.c (revision 211279) +++ quota.c (working copy) @@ -266,7 +266,7 @@ static void prthumanval(int len, u_int64_t bytes) { - char buf[len + 1]; + char buf[5]; humanize_number(buf, sizeof(buf), bytes, "", HN_AUTOSCALE, HN_B | HN_NOSPACE | HN_DECIMAL); @@ -356,10 +356,13 @@ prthumanval(7, dbtob(qup->dqblk.dqb_bhardlimit)); } else { printf(" %7ju%c %7ju %7ju", - dbtob(1024) * (uintmax_t)qup->dqblk.dqb_curblocks, + (uintmax_t)dbtob(qup->dqblk.dqb_curblocks) + / 1024, (msgb == NULL) ? ' ' : '*', - dbtob(1024) * (uintmax_t)qup->dqblk.dqb_bsoftlimit, - dbtob(1024) * (uintmax_t)qup->dqblk.dqb_bhardlimit); + (uintmax_t)dbtob(qup->dqblk.dqb_bsoftlimit) + / 1024, + (uintmax_t)dbtob(qup->dqblk.dqb_bhardlimit) + / 1024); } if (msgb != NULL) bgrace = timeprt(qup->dqblk.dqb_btime); >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201008311506.o7VF6dHI079125>