Bug 104712 - incorrect quota.h headers make quotactl() unuseable
incorrect quota.h headers make quotactl() unuseable
Product: Red Hat Linux
Classification: Retired
Component: quota (Show other bugs)
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Steve Dickson
Brock Organ
Depends On:
  Show dependency treegraph
Reported: 2003-09-19 11:55 EDT by Tim Mooney
Modified: 2007-04-18 12:57 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-09-06 09:09:50 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Tim Mooney 2003-09-19 11:55:00 EDT
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

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:

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

/* 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;

     (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 12:33:41 EDT
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 16:52:07 EDT
This bug is still present in Fedora Core 4!!!
Comment 4 Jakub Jelinek 2005-09-06 09:09:50 EDT
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.

Note You need to log in before you can comment on or make changes to this bug.