Red Hat Bugzilla – Bug 104712
incorrect quota.h headers make quotactl() unuseable
Last modified: 2007-04-18 12:57:40 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):
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
struct dqblk user_quota;
ret_val=quotactl( QCMD(Q_GETQUOTA,USRQUOTA) , THE_DEVICE, THE_UID,
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.
Just ask, I'll provide more details if you need them.
Of course when I said
"doesn't provide the write bits..."
"doesn't provide the right (correct) bits..."
I do know the difference, but not enough caffeine yet...
This bug is still present in Fedora Core 4!!!
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.