From owner-freebsd-bugs Tue Oct 6 04:20:09 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id EAA28344 for freebsd-bugs-outgoing; Tue, 6 Oct 1998 04:20:09 -0700 (PDT) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id EAA28300 for ; Tue, 6 Oct 1998 04:20:03 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.8.8/8.8.5) id EAA26290; Tue, 6 Oct 1998 04:20:01 -0700 (PDT) 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 ; 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 X-Send-Pr-Version: 3.2 Subject: bin/8164: repquota incorrectly reports quotas larger than 4Gbytes Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 8164 >Category: bin >Synopsis: repquota incorrectly reports quotas larger than 4Gbytes >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Oct 6 04:20:01 PDT 1998 >Last-Modified: >Originator: Anton Berezin >Organization: The Protein Laboratory, University of Copenhagen >Release: FreeBSD 2.2.7-RELEASE i386 >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 #include +/* 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 ? >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message