Bug 104712

Summary: incorrect quota.h headers make quotactl() unuseable
Product: [Retired] Red Hat Linux Reporter: Tim Mooney <mooney>
Component: quotaAssignee: Steve Dickson <steved>
Status: CLOSED ERRATA QA Contact: Brock Organ <borgan>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.3CC: jakub
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-09-06 13:09:50 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Tim Mooney 2003-09-19 15:55:00 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; OSF1 alpha; en-US; rv:1.3) Gecko/20030424

Description of problem:
The quotactl() man page documents that <linux/quota.h> should be included for
programming with the quotactl() call.  The quota.h that is
/usr/include/linux/quota.h (owned by glibc-kernheaders-2.4-7.16):

 - doesn't provide a prototype for quotactl
 - does not provide the write bits for ``cmd'' arguments to the QCMD
   macro.  For example, trying to use QCMD(Q_GETQUOTA,USRQUOTA)
   results in an EINVAL return from quotactl, because the bits
   for Q_GETQUOTA defined in linux/quota.h are wrong.

In addition, there is another "decoy" quota.h installed on the system:

$rpm -q -f /usr/include/sys/quota.h
glibc-devel-2.2.5-43

This file appears to be for use with an older quota implementation.

In any case, there is no way for a user to write application code that calls
quotactl() until they stumble on the fact that the `quota.h' that's included
right in the ``quota-3.06-9.7.src.rpm'' appears to be the one that has the
correct bit defines.  This header file never gets installed, though, so it's
impossible for a developer to find a quota.h installed on a RH system that gives
the necessary stuff to use quotactl().

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
Try compile a simple program on RH 7.3 (or later, and including RH ES 2.1) that
calls

/* change these to be a device that has quotas configured and on, and a user
 * id that you want to check
 */
#define THE_DEVICE   "/dev/md7"
#define THE_UID      101

   int ret_val;
   struct dqblk user_quota;

  ret_val=quotactl( QCMD(Q_GETQUOTA,USRQUOTA) , THE_DEVICE, THE_UID,
     (caddr_t) &user_quota);

Using any of the installed header files on the system, you'll get EINVAL.

Actual Results:  EINVAL because Q_GETQUOTA (and some of the other sub-commands)
use the wrong bits.

Expected Results:  0 return, with user_quota filled in.

Additional info:

Just ask, I'll provide more details if you need them.

Comment 1 Tim Mooney 2003-09-19 16:33:41 UTC
Of course when I said

 "doesn't provide the write bits..."

I meant

 "doesn't provide the right (correct) bits..."

I do know the difference, but not enough caffeine yet...

Comment 2 Dominik Mierzejewski 2005-07-20 20:52:07 UTC
This bug is still present in Fedora Core 4!!!

Comment 4 Jakub Jelinek 2005-09-06 13:09:50 UTC
Yeah, both glibc-headers and glibc-kernheaders.
glibc-headers-2.3.5-10.3 (i.e. FC4 glibc update) sys/quota.h defaults to
the new quota interface.
And glibc-kernheaders-2.4-9.1.94 linux/quota.h just #includes sys/quota.h
with a warning, as it should.