From tobez@lion.plab.ku.dk  Tue Oct  6 04:16:22 1998
Received: from lion.plab.ku.dk (lion.plab.ku.dk [130.225.105.49])
          by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id EAA27725
          for <FreeBSD-gnats-submit@freebsd.org>; Tue, 6 Oct 1998 04:16:17 -0700 (PDT)
          (envelope-from tobez@lion.plab.ku.dk)
Received: (from tobez@localhost)
	by lion.plab.ku.dk (8.8.8/8.8.8) id NAA21040;
	Tue, 6 Oct 1998 13:16:06 +0200 (CEST)
	(envelope-from tobez)
Message-Id: <199810061116.NAA21040@lion.plab.ku.dk>
Date: Tue, 6 Oct 1998 13:16:06 +0200 (CEST)
From: tobez@plab.ku.dk
Reply-To: tobez@plab.ku.dk
To: FreeBSD-gnats-submit@freebsd.org
Subject: repquota incorrectly reports quotas larger than 4Gbytes
X-Send-Pr-Version: 3.2

>Number:         8164
>Category:       bin
>Synopsis:       [patch] repquota incorrectly reports quotas larger than 4Gbytes
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Oct  6 04:20:01 PDT 1998
>Closed-Date:    Sun Oct 31 20:47:43 PST 1999
>Last-Modified:  Sun Oct 31 20:48:28 PST 1999
>Originator:     Anton Berezin
>Release:        FreeBSD 2.2.7-RELEASE i386
>Organization:
The Protein Laboratory, University of Copenhagen
>Environment:

	"$Id: repquota.c,v 1.3.6.3 1998/03/09 13:52:17 jkh Exp $"

>Description:

	repquota reports softlimits, hardlimits and ``used'' field
incorrectly, namely those numbers get wrapped modulo 4Gbytes.

>How-To-Repeat:

	The easiest way is to create files owned by particular
user/group with total sizes exceeding 4Gbytes, and look at the
repquota-generated output.

>Fix:
	
--- repquota.c.orig	Mon Oct  5 20:07:59 1998
+++ repquota.c	Mon Oct  5 20:50:10 1998
@@ -64,6 +64,18 @@
 #include <string.h>
 #include <unistd.h>
 
+/* Let's be paranoid about block size */
+#if 10 > DEV_BSHIFT
+#define dbtokb(db) \
+        ((off_t)(db) >> (10-DEV_BSHIFT))
+#elif 10 < DEV_BSHIFT
+#define dbtokb(db) \
+        ((off_t)(db) << (DEV_BSHIFT-10))
+#else
+#define dbtokb(db)	(db)
+#endif
+
+
 char *qfname = QUOTAFILENAME;
 char *qfextension[] = INITQFNAMES;
 
@@ -233,9 +245,9 @@
 			fup->fu_dqblk.dqb_isoftlimit &&
 			    fup->fu_dqblk.dqb_curinodes >=
 			    fup->fu_dqblk.dqb_isoftlimit ? '+' : '-',
-			(u_long)(dbtob(fup->fu_dqblk.dqb_curblocks) / 1024),
-			(u_long)(dbtob(fup->fu_dqblk.dqb_bsoftlimit) / 1024),
-			(u_long)(dbtob(fup->fu_dqblk.dqb_bhardlimit) / 1024),
+			(u_long)(dbtokb(fup->fu_dqblk.dqb_curblocks)),
+			(u_long)(dbtokb(fup->fu_dqblk.dqb_bsoftlimit)),
+			(u_long)(dbtokb(fup->fu_dqblk.dqb_bhardlimit)),
 			fup->fu_dqblk.dqb_bsoftlimit &&
 			    fup->fu_dqblk.dqb_curblocks >=
 			    fup->fu_dqblk.dqb_bsoftlimit ?
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: julian 
State-Changed-When: Sun Oct 31 20:47:43 PST 1999 
State-Changed-Why:  
applied patch 
(to -current) 
>Unformatted:
