From nobody@FreeBSD.org  Thu Oct 19 15:25:50 2006
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id DDF5C16A403
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 19 Oct 2006 15:25:50 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 8F64543D76
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 19 Oct 2006 15:25:48 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id k9JFPmMJ044472
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 19 Oct 2006 15:25:48 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id k9JFPmhL044471;
	Thu, 19 Oct 2006 15:25:48 GMT
	(envelope-from nobody)
Message-Id: <200610191525.k9JFPmhL044471@www.freebsd.org>
Date: Thu, 19 Oct 2006 15:25:48 GMT
From: Michael Hanselmann<freebsd@hansmi.ch>
To: freebsd-gnats-submit@FreeBSD.org
Subject: quota program fails to seperate columns when using large limits
X-Send-Pr-Version: www-3.0

>Number:         104573
>Category:       bin
>Synopsis:       [patch] quota(1) fails to seperate columns when using large limits
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Oct 19 15:30:15 GMT 2006
>Closed-Date:    Sun Feb 24 20:12:27 UTC 2008
>Last-Modified:  Sun Feb 24 20:12:27 UTC 2008
>Originator:     Michael Hanselmann
>Release:        5.3-RELEASE-p4, 4.11-RELEASE-p25
>Organization:
>Environment:
FreeBSD host.domain.tld 5.3-RELEASE-p4 FreeBSD 5.3-RELEASE-p4 #0: Fri Jan  7 14:36:44 CET 2005     root@host.domain.tld:/usr/obj/usr/src/sys/GENERIC  i386
>Description:
When using large limits for quotas, for example 20 GB, /usr/bin/quota joins the columns:

Disk quotas for user testhost (uid 2000):
     Filesystem   usage   quota   limit   grace   files   quota   limit   grace
          /home    1710 2097152020971520             163       0       0

>How-To-Repeat:
Set 20 GB as quota, show it using /usr/bin/quota
>Fix:
Use mandatory spaces between columns, see attached patch.

Patch attached with submission follows:

? quota
? quota.1.gz
Index: quota.c
===================================================================
RCS file: /home/ncvs/src/usr.bin/quota/quota.c,v
retrieving revision 1.24
diff -u -r1.24 quota.c
--- quota.c	13 Mar 2005 17:58:31 -0000	1.24
+++ quota.c	19 Oct 2006 15:23:43 -0000
@@ -310,7 +310,7 @@
 				printf("%s\n", qup->fsname);
 				nam = "";
 			} 
-			printf("%15s%8lu%c%7lu%8lu%8s"
+			printf("%12s %7lu %c %7lu %7lu %7s"
 				, nam
 				, (u_long) (dbtob(qup->dqblk.dqb_curblocks)
 					    / 1024)
@@ -321,7 +321,7 @@
 					    / 1024)
 				, (msgb == (char *)0) ? ""
 				    :timeprt(qup->dqblk.dqb_btime));
-			printf("%8lu%c%7lu%8lu%8s\n"
+			printf("%7lu %c %7lu %7lu %7s\n"
 				, (u_long)qup->dqblk.dqb_curinodes
 				, (msgi == (char *)0) ? ' ' : '*'
 				, (u_long)qup->dqblk.dqb_isoftlimit

>Release-Note:
>Audit-Trail:

From: Michael Hanselmann <freebsd@hansmi.ch>
To: bug-followup@FreeBSD.org, freebsd@hansmi.ch
Cc:  
Subject: Re: misc/104573: quota program fails to seperate columns when using large limits
Date: Thu, 19 Oct 2006 20:53:52 +0200

 Here's a better patch, which should conserve the exact positions of
 columns:
 
 diff -u -r1.24 quota.c
 --- quota.c	13 Mar 2005 17:58:31 -0000	1.24
 +++ quota.c	19 Oct 2006 18:48:35 -0000
 @@ -310,7 +310,7 @@
  				printf("%s\n", qup->fsname);
  				nam = "";
  			} 
 -			printf("%15s%8lu%c%7lu%8lu%8s"
 +			printf("%15s %7lu %c%6lu %7lu %7s"
  				, nam
  				, (u_long) (dbtob(qup->dqblk.dqb_curblocks)
  					    / 1024)
 @@ -321,7 +321,7 @@
  					    / 1024)
  				, (msgb == (char *)0) ? ""
  				    :timeprt(qup->dqblk.dqb_btime));
 -			printf("%8lu%c%7lu%8lu%8s\n"
 +			printf(" %7lu %c%6lu %7lu %7s\n"
  				, (u_long)qup->dqblk.dqb_curinodes
  				, (msgi == (char *)0) ? ' ' : '*'
  				, (u_long)qup->dqblk.dqb_isoftlimit
State-Changed-From-To: open->closed 
State-Changed-By: mpp 
State-Changed-When: Sun Feb 24 20:08:52 UTC 2008 
State-Changed-Why:  
This was fixed in revision 1.30 of usr.bin/quota/quota.c and first 
appeared in the FreeBSD 6.3 release. 

The "-h" option of quota can also be used to display such large 
quota values in a more usable format. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=104573 
>Unformatted:
