From fullermd@over-yonder.net  Sun Dec 19 16:20:20 2004
Return-Path: <fullermd@over-yonder.net>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id C470A16A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 19 Dec 2004 16:20:20 +0000 (GMT)
Received: from mortis.over-yonder.net (adsl-155-73-249.jan.bellsouth.net [68.155.73.249])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 3EBAA43D39
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 19 Dec 2004 16:20:20 +0000 (GMT)
	(envelope-from fullermd@over-yonder.net)
Received: by mortis.over-yonder.net (Postfix, from userid 100)
	id 4F960210DB; Sun, 19 Dec 2004 10:20:19 -0600 (CST)
Message-Id: <20041219162019.4F960210DB@mortis.over-yonder.net>
Date: Sun, 19 Dec 2004 10:20:19 -0600 (CST)
From: Matthew D.Fuller <fullermd@over-yonder.net>
Reply-To: Matthew D.Fuller <fullermd@over-yonder.net>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [PATCH] repquota(8) field size a smidge too small
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         75259
>Category:       bin
>Synopsis:       [PATCH] repquota(8) field size a smidge too small
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    maxim
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Dec 19 16:30:27 GMT 2004
>Closed-Date:    Mon Dec 27 13:24:18 GMT 2004
>Last-Modified:  Mon Dec 27 13:24:18 GMT 2004
>Originator:     Matthew D. Fuller
>Release:        FreeBSD 5.3-STABLE i386
>Organization:
>Environment:
System: FreeBSD mortis.sighup.org 5.3-STABLE FreeBSD 5.3-STABLE #0: Sat Nov 20 10:24:06 CST 2004 fullermd@mortis:/usr/obj/usr/src/sys/MORTIS i386


	
>Description:
    repquota(8) lists out the quota information for all users on the
    system.  The first field, naturally, contains the username.  It's
    awful convenient and tempting to pipe the output to sort(1) or the
    like.

    However, that will break all over you if there's a username that's up
    at the max size (16).
>How-To-Repeat:
    Add a user with a 16-char username, put in a bunch of files, then do
    a repquota | sort -n +2 and see if they're near the bottom.

>Fix:

Index: repquota.c
===================================================================
RCS file: /usr/cvs/src/usr.sbin/repquota/repquota.c,v
retrieving revision 1.18
diff -u -r1.18 repquota.c
--- repquota.c	7 Aug 2004 04:28:54 -0000	1.18
+++ repquota.c	19 Dec 2004 16:14:48 -0000
@@ -229,9 +229,9 @@
 	}
 	fclose(qf);
 	printf("%*s                Block  limits                    File  limits\n",
-		max(UT_NAMESIZE,10), " ");
+		max(UT_NAMESIZE+1,10), " ");
 	printf("User%*s   used     soft     hard  grace     used    soft    hard  grace\n",
-		max(UT_NAMESIZE,10), " ");
+		max(UT_NAMESIZE+1,10), " ");
 	for (id = 0; id <= highid[type]; id++) {
 		fup = lookup(id, type);
 		if (fup == 0)
@@ -239,7 +239,7 @@
 		if (fup->fu_dqblk.dqb_curinodes == 0 &&
 		    fup->fu_dqblk.dqb_curblocks == 0)
 			continue;
-		printf("%-*s", max(UT_NAMESIZE,10), fup->fu_name);
+		printf("%-*s", max(UT_NAMESIZE+1,10), fup->fu_name);
 		printf("%c%c %8lu %8lu %8lu %6s",
 			fup->fu_dqblk.dqb_bsoftlimit &&
 			    fup->fu_dqblk.dqb_curblocks >=
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->patched 
State-Changed-By: maxim 
State-Changed-When: Sun Dec 19 18:03:48 GMT 2004 
State-Changed-Why:  
An equal diff was committed to -CURRENT, thanks! 


Responsible-Changed-From-To: freebsd-bugs->maxim 
Responsible-Changed-By: maxim 
Responsible-Changed-When: Sun Dec 19 18:03:48 GMT 2004 
Responsible-Changed-Why:  
MFC reminder. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=75259 
State-Changed-From-To: patched->closed 
State-Changed-By: maxim 
State-Changed-When: Mon Dec 27 13:23:59 GMT 2004 
State-Changed-Why:  
Fixed in RELENG_5 and RELENG_4 as well. 

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