[arch-commits] Commit in quota-tools/trunk (5 files)
Eric Bélanger
eric at archlinux.org
Fri Jul 15 11:55:43 UTC 2011
Date: Friday, July 15, 2011 @ 07:55:43
Author: eric
Revision: 131802
upgpkg: quota-tools 4.00_pre1-1
Upstream update, Removed tcp_wrappers support, Added misc patches
Added:
quota-tools/trunk/nulls.diff
quota-tools/trunk/quotaon.diff
quota-tools/trunk/repquota.diff
quota-tools/trunk/system_inodes.diff
Modified:
quota-tools/trunk/PKGBUILD
--------------------+
PKGBUILD | 31 +++++--
nulls.diff | 20 ++++
quotaon.diff | 216 +++++++++++++++++++++++++++++++++++++++++++++++++++
repquota.diff | 91 +++++++++++++++++++++
system_inodes.diff | 18 ++++
5 files changed, 368 insertions(+), 8 deletions(-)
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2011-07-15 11:48:24 UTC (rev 131801)
+++ PKGBUILD 2011-07-15 11:55:43 UTC (rev 131802)
@@ -2,24 +2,39 @@
# Maintainer: Eric Bélanger <eric at archlinux.org>
pkgname=quota-tools
-pkgver=3.17
-pkgrel=2
+pkgver=4.00_pre1
+pkgrel=1
pkgdesc="Tools to manage kernel-level quotas in Linux"
arch=('i686' 'x86_64')
url="http://sourceforge.net/projects/linuxquota/"
license=('GPL' 'BSD')
-depends=('e2fsprogs' 'tcp_wrappers')
+depends=('e2fsprogs')
backup=('etc/warnquota.conf' 'etc/quotatab' 'etc/quotagrpadmins')
options=('!emptydirs')
-source=(http://downloads.sourceforge.net/sourceforge/linuxquota/quota-${pkgver}.tar.gz LICENSE)
-md5sums=('cb3e98a039c0cf98e7c1ad4b50a5bda7'
- 'dd792440e684043e4e4ef80963d0237b')
-sha1sums=('8dc04ea803a43496dfe275a8260757f558a2d762'
- '57297bdc9e638c500506169bbbe12eb89bcf7d07')
+source=(http://downloads.sourceforge.net/sourceforge/linuxquota/quota-${pkgver/_/-}.tar.gz LICENSE \
+ quotaon.diff system_inodes.diff repquota.diff nulls.diff)
+md5sums=('ef9d66e8a968ecffd2d9df648fa8ada2'
+ 'dd792440e684043e4e4ef80963d0237b'
+ '9ac7ca4746de1ad057baee21474b7906'
+ '92d9f2a4b3e5e3adf2977051391785a7'
+ 'd1d70d4167e53d1414079b4391f1cfb8'
+ '094bce5226c4fd1c383bd0b75405ee2c')
+sha1sums=('adf29b49dab449078eb6ffdfe8af51fe85419e28'
+ '57297bdc9e638c500506169bbbe12eb89bcf7d07'
+ '2304f03cddd06d8791167f621683f7ef54610673'
+ 'e2a33f1f95a3ff8c741a2067058e898f6054af09'
+ '8b00e7c4f7af2188ad49a50a616c1d71eee20459'
+ '0527f761aa869f5d9e463ceab4a3bf82881d05c2')
build() {
cd "${srcdir}/${pkgname}"
+ patch -p1 -i "${srcdir}/quotaon.diff"
+ patch -p1 -i "${srcdir}/system_inodes.diff"
+ patch -p1 -i "${srcdir}/repquota.diff"
+ patch -p1 -i "${srcdir}/nulls.diff"
./configure --prefix=/usr --sysconfdir=/etc
+ sed -i -e 's/#define HOSTS_ACCESS 1//' -e 's/HOSTS_ACCESS//' config.h
+ sed -i 's/-lwrap//' Makefile
make
}
Added: nulls.diff
===================================================================
--- nulls.diff (rev 0)
+++ nulls.diff 2011-07-15 11:55:43 UTC (rev 131802)
@@ -0,0 +1,20 @@
+#Description: Avoid memory corruption of NULL address
+#Author: Petr Pisar
+
+--- quota/quotasys.c 2010-02-18 09:44:11.000000000 +0100
++++ quota-tools/quotasys.c 2010-05-05 08:02:53.000000000 +0200
+@@ -746,9 +746,12 @@
+ kernel_qfmt_num = 0;
+ if (!stat("/proc/fs/xfs/stat", &st))
+ kernel_qfmt[kernel_qfmt_num++] = QF_XFS;
+- else
+- if (!quotactl(QCMD(Q_XGETQSTAT, 0), NULL, 0, NULL) || (errno != EINVAL && errno != ENOSYS))
++ else {
++ fs_quota_stat_t dummy;
++
++ if (!quotactl(QCMD(Q_XGETQSTAT, 0), "/dev/root", 0, (void *)&dummy) || (errno != EINVAL && errno != ENOSYS))
+ kernel_qfmt[kernel_qfmt_num++] = QF_XFS;
++ }
+ /* Detect new kernel interface; Assume generic interface unless we can prove there is not one... */
+ if (!stat("/proc/sys/fs/quota", &st) || errno != ENOENT) {
+ kernel_iface = IFACE_GENERIC;
Added: quotaon.diff
===================================================================
--- quotaon.diff (rev 0)
+++ quotaon.diff 2011-07-15 11:55:43 UTC (rev 131802)
@@ -0,0 +1,216 @@
+# Description: Fix quotaon to work with XFS and print all informational messages only in verbose mode
+# Author: Jan Kara
+
+diff -u quota/quotaon.c quota-tools/quotaon.c
+--- quota/quotaon.c 2010-07-28 11:14:02.000000000 +0200
++++ quota-tools/quotaon.c 2010-06-15 10:11:30.000000000 +0200
+@@ -42,6 +42,7 @@
+ #include <getopt.h>
+ #include <string.h>
+ #include <stdlib.h>
++#include <stdarg.h>
+
+ #include "quotaon.h"
+ #include "quota.h"
+@@ -145,6 +146,19 @@
+ }
+ }
+
++int pinfo(char *fmt, ...)
++{
++ va_list arg;
++ int ret;
++
++ if (!(flags & FL_VERBOSE))
++ return 0;
++ va_start(arg, fmt);
++ ret = vprintf(fmt, arg);
++ va_end(arg);
++ return ret;
++}
++
+ /*
+ * Enable/disable rsquash on given filesystem
+ */
+@@ -171,10 +185,10 @@
+ errstr(_("set root_squash on %s: %s\n"), quotadev, strerror(errno));
+ return 1;
+ }
+- if ((flags & STATEFLAG_VERBOSE) && (flags & STATEFLAG_OFF))
+- printf(_("%s: %s root_squash turned off\n"), quotadev, type2name(type));
+- else if ((flags & STATEFLAG_VERBOSE) && (flags & STATEFLAG_ON))
+- printf(_("%s: %s root_squash turned on\n"), quotadev, type2name(type));
++ if (flags & STATEFLAG_OFF)
++ pinfo(_("%s: %s root_squash turned off\n"), quotadev, type2name(type));
++ else if (flags & STATEFLAG_ON)
++ pinfo(_("%s: %s root_squash turned on\n"), quotadev, type2name(type));
+ #endif
+ return 0;
+ }
+@@ -195,8 +209,7 @@
+ errstr(_("quotactl on %s [%s]: %s\n"), quotadev, quotadir, strerror(errno));
+ return 1;
+ }
+- if (flags & STATEFLAG_VERBOSE)
+- printf(_("%s [%s]: %s quotas turned off\n"), quotadev, quotadir, type2name(type));
++ pinfo(_("%s [%s]: %s quotas turned off\n"), quotadev, quotadir, type2name(type));
+ return 0;
+ }
+ if (kernel_iface == IFACE_GENERIC) {
+@@ -218,8 +231,7 @@
+ errstr(_("Quota format not supported in kernel.\n"));
+ return 1;
+ }
+- if (flags & STATEFLAG_VERBOSE)
+- printf(_("%s [%s]: %s quotas turned on\n"), quotadev, quotadir, type2name(type));
++ pinfo(_("%s [%s]: %s quotas turned on\n"), quotadev, quotadir, type2name(type));
+ return 0;
+ }
+
+@@ -268,8 +280,6 @@
+ int sflags, ret = 0;
+
+ sflags = flags & FL_OFF ? STATEFLAG_OFF : STATEFLAG_ON;
+- if (flags & FL_VERBOSE)
+- sflags |= STATEFLAG_VERBOSE;
+ if (flags & FL_ALL)
+ sflags |= STATEFLAG_ALL;
+
+@@ -281,10 +291,7 @@
+ errstr(_("Cannot change state of XFS quota. It's not compiled in kernel.\n"));
+ return 1;
+ }
+- if ((flags & FL_OFF && (kern_quota_on(mnt->mnt_fsname, USRQUOTA, QF_XFS) != -1
+- || kern_quota_on(mnt->mnt_fsname, GRPQUOTA, QF_XFS) != -1))
+- || (!(flags & FL_OFF) && kern_quota_on(mnt->mnt_fsname, type, QF_XFS) == -1))
+- ret = xfs_newstate(mnt, type, extra, sflags);
++ ret = xfs_newstate(mnt, type, extra, sflags);
+ }
+ else if (meta_qf_fstype(mnt->mnt_type)) {
+ if (!hasquota(mnt, type, 0))
+@@ -376,7 +383,7 @@
+ while ((mnt = get_next_mount())) {
+ if (nfs_fstype(mnt->mnt_type)) {
+ if (!(flags & FL_ALL))
+- fprintf(stderr, "%s: Quota cannot be turned on on NFS filesystem\n", mnt->mnt_fsname);
++ errstr(_("%s: Quota cannot be turned on on NFS filesystem\n"), mnt->mnt_fsname);
+ continue;
+ }
+
+diff -u quota/quotaon.h quota-tools/quotaon.h
+--- quota/quotaon.h 2010-02-18 09:44:11.000000000 +0100
++++ quota-tools/quotaon.h 2010-06-12 12:06:08.000000000 +0200
+@@ -13,7 +13,7 @@
+ #define STATEFLAG_ON 0x01
+ #define STATEFLAG_OFF 0x02
+ #define STATEFLAG_ALL 0x04
+-#define STATEFLAG_VERBOSE 0x08
+
+ typedef int (newstate_t) (struct mntent * mnt, int type, char *file, int flags);
+ extern int xfs_newstate(struct mntent *mnt, int type, char *file, int flags);
++extern int pinfo(char *fmt, ...);
+diff -u quota/quotaon_xfs.c quota-tools/quotaon_xfs.c
+--- quota/quotaon_xfs.c 2010-07-26 18:48:24.000000000 +0200
++++ quota-tools/quotaon_xfs.c 2010-06-15 10:11:30.000000000 +0200
+@@ -59,8 +59,8 @@
+ return 1;
+ case Q_XFS_QUOTAON:
+ if (roothack) {
+- printf(_("Enabling %s quota on root filesystem"
+- " (reboot to take effect)\n"), type2name(type));
++ pinfo(_("Enabling %s quota on root filesystem"
++ " (reboot to take effect)\n"), type2name(type));
+ return 1;
+ }
+ errstr(_("Enable XFS %s quota accounting during mount\n"),
+@@ -79,12 +79,12 @@
+ return -1;
+ case Q_XFS_QUOTAON:
+ if (roothack) {
+- printf(_("Enabling %s quota on root filesystem"
+- " (reboot to take effect)\n"), type2name(type));
++ pinfo(_("Enabling %s quota on root filesystem"
++ " (reboot to take effect)\n"), type2name(type));
+ return 1;
+ }
+ if (xopts & XFS_QUOTA_UDQ_ENFD || xopts & XFS_QUOTA_GDQ_ENFD) {
+- printf(_("Enabling %s quota enforcement on %s\n"), type2name(type), dev);
++ pinfo(_("Enabling %s quota enforcement on %s\n"), type2name(type), dev);
+ return 1;
+ }
+ errstr(_("Already accounting %s quota on %s\n"),
+@@ -92,7 +92,7 @@
+ return -1;
+ case Q_XFS_QUOTAOFF:
+ if (xopts & XFS_QUOTA_UDQ_ACCT || xopts & XFS_QUOTA_GDQ_ACCT) {
+- printf(_("Disabling %s quota accounting on %s\n"),
++ pinfo(_("Disabling %s quota accounting on %s\n"),
+ type2name(type), dev);
+ return 1;
+ }
+@@ -121,9 +121,9 @@
+ return -1;
+ }
+ if (xopts & XFS_QUOTA_UDQ_ACCT || xopts & XFS_QUOTA_GDQ_ACCT)
+- acctstr = _("and accounting ");
+- printf(_("Disabling %s quota enforcement %son %s\n"),
+- type2name(type), acctstr, dev);
++ acctstr = _("and accounting ");
++ pinfo(_("Disabling %s quota enforcement %son %s\n"),
++ type2name(type), acctstr, dev);
+ return 1;
+ }
+ break;
+@@ -146,10 +146,10 @@
+ errstr(_("quotactl on %s: %s\n"), dev, strerror(errno));
+ return 1;
+ }
+- if ((flags & STATEFLAG_VERBOSE) && qoff)
+- printf(_("%s: %s quotas turned off\n"), dev, type2name(type));
+- else if ((flags & STATEFLAG_VERBOSE) && !qoff)
+- printf(_("%s: %s quotas turned on\n"), dev, type2name(type));
++ if (qoff)
++ pinfo(_("%s: %s quotas turned off\n"), dev, type2name(type));
++ else
++ pinfo(_("%s: %s quotas turned on\n"), dev, type2name(type));
+ return 0;
+ }
+
+@@ -168,8 +168,7 @@
+ return 1;
+ }
+
+- if (flags & STATEFLAG_VERBOSE)
+- printf(_("%s: deleted %s quota blocks\n"), dev, type2name(type));
++ pinfo(_("%s: deleted %s quota blocks\n"), dev, type2name(type));
+ return 0;
+ }
+
+@@ -208,16 +207,12 @@
+ }
+ #endif /* XFS_ROOTHACK */
+
+- if (xarg == NULL) { /* both acct & enfd on/off */
+- xopts |= (type == USRQUOTA) ?
+- (XFS_QUOTA_UDQ_ACCT | XFS_QUOTA_UDQ_ENFD) :
+- (XFS_QUOTA_GDQ_ACCT | XFS_QUOTA_GDQ_ENFD);
++ if (xarg == NULL) { /* only enfd on/off */
++ xopts |= (type == USRQUOTA) ? XFS_QUOTA_UDQ_ENFD :
++ XFS_QUOTA_GDQ_ENFD;
+ err = xfs_onoff((char *)dev, type, flags, roothack, xopts);
+ }
+ else if (strcmp(xarg, "account") == 0) {
+- /* only useful if we want root accounting only */
+- if (!roothack || !(flags & STATEFLAG_ON))
+- goto done;
+ xopts |= (type == USRQUOTA) ? XFS_QUOTA_UDQ_ACCT : XFS_QUOTA_GDQ_ACCT;
+ err = xfs_onoff((char *)dev, type, flags, roothack, xopts);
+ }
+@@ -231,7 +226,6 @@
+ }
+ else
+ die(1, _("Invalid argument \"%s\"\n"), xarg);
+- done:
+ free((char *)dev);
+ return err;
+ }
Added: repquota.diff
===================================================================
--- repquota.diff (rev 0)
+++ repquota.diff 2011-07-15 11:55:43 UTC (rev 131802)
@@ -0,0 +1,91 @@
+# Description: fix repquota to get latest quota info header
+# Author: Jan Kara
+
+diff -u quota/quotaio.c quota-tools/quotaio.c
+--- quota/quotaio.c 2010-07-28 11:14:02.000000000 +0200
++++ quota-tools/quotaio.c 2010-05-28 09:05:21.000000000 +0200
+@@ -147,6 +147,15 @@
+ }
+ }
+ if (!QIO_ENABLED(h) || flags & IOI_OPENFILE) { /* Need to open file? */
++ if (QIO_ENABLED(h)) { /* Kernel uses same file? */
++ unsigned int cmd =
++ (kernel_iface == IFACE_GENERIC) ? Q_SYNC : Q_6_5_SYNC;
++ if (quotactl(QCMD(cmd, h->qh_type), h->qh_quotadev,
++ 0, NULL) < 0) {
++ die(4, _("Cannot sync quotas on device %s: %s\n"),
++ h->qh_quotadev, strerror(errno));
++ }
++ }
+ /* We still need to open file for operations like 'repquota' */
+ if ((fd = open(qfname, QIO_RO(h) ? O_RDONLY : O_RDWR)) < 0) {
+ errstr(_("Cannot open quotafile %s: %s\n"),
+diff -u quota/quotaio_v1.c quota-tools/quotaio_v1.c
+--- quota/quotaio_v1.c 2010-07-26 18:48:24.000000000 +0200
++++ quota-tools/quotaio_v1.c 2010-05-28 09:05:23.000000000 +0200
+@@ -348,11 +348,6 @@
+ struct dquot *dquot = get_empty_dquot();
+ qid_t id = 0;
+
+- if (QIO_ENABLED(h)) /* Kernel uses same file? */
+- if (quotactl(QCMD((kernel_iface == IFACE_GENERIC) ? Q_SYNC : Q_6_5_SYNC, h->qh_type),
+- h->qh_quotadev, 0, NULL) < 0)
+- die(4, _("Cannot sync quotas on device %s: %s\n"), h->qh_quotadev,
+- strerror(errno));
+ memset(dquot, 0, sizeof(*dquot));
+ dquot->dq_h = h;
+ lseek(h->qh_fd, 0, SEEK_SET);
+diff -u quota/quotaio_v2.c quota-tools/quotaio_v2.c
+--- quota/quotaio_v2.c 2010-02-18 09:44:11.000000000 +0100
++++ quota-tools/quotaio_v2.c 2010-05-28 09:05:23.000000000 +0200
+@@ -484,11 +484,6 @@
+
+ static int v2_scan_dquots(struct quota_handle *h, int (*process_dquot) (struct dquot *, char *))
+ {
+- if (QIO_ENABLED(h)) /* Kernel uses same file? */
+- if (quotactl(QCMD((kernel_iface == IFACE_GENERIC) ? Q_SYNC : Q_6_5_SYNC, h->qh_type),
+- h->qh_quotadev, 0, NULL) < 0)
+- die(4, _("Cannot sync quotas on device %s: %s\n"), h->qh_quotadev,
+- strerror(errno));
+ return qtree_scan_dquots(h, process_dquot);
+ }
+
+diff -u quota/quotasys.c quota-tools/quotasys.c
+--- quota/quotasys.c 2010-07-28 11:14:02.000000000 +0200
++++ quota-tools/quotasys.c 2010-06-15 10:11:30.000000000 +0200
+@@ -861,22 +861,23 @@
+ if (kernel_iface == IFACE_GENERIC) {
+ int actfmt;
+
+- if (quotactl(QCMD(Q_GETFMT, type), dev, 0, (void *)&actfmt) < 0)
+- return -1;
+- actfmt = kern2utilfmt(actfmt);
+- if (actfmt < 0)
+- return -1;
+- return actfmt;
++ if (quotactl(QCMD(Q_GETFMT, type), dev, 0,
++ (void *)&actfmt) >= 0) {
++ actfmt = kern2utilfmt(actfmt);
++ if (actfmt >= 0)
++ return actfmt;
++ }
++ } else {
++ if ((fmt == -1 || fmt == QF_VFSV0) &&
++ v2_kern_quota_on(dev, type)) /* VFSv0 quota format */
++ return QF_VFSV0;
++ if ((fmt == -1 || fmt == QF_VFSOLD) &&
++ v1_kern_quota_on(dev, type)) /* Old quota format */
++ return QF_VFSOLD;
+ }
+- if ((fmt == -1 || fmt == QF_VFSV0) &&
+- v2_kern_quota_on(dev, type)) /* VFSv0 quota format */
+- return QF_VFSV0;
+ if ((fmt == -1 || fmt == QF_XFS) &&
+ xfs_kern_quota_on(dev, type)) /* XFS quota format */
+ return QF_XFS;
+- if ((fmt == -1 || fmt == QF_VFSOLD) &&
+- v1_kern_quota_on(dev, type)) /* Old quota format */
+- return QF_VFSOLD;
+ return -1;
+ }
+
Added: system_inodes.diff
===================================================================
--- system_inodes.diff (rev 0)
+++ system_inodes.diff 2011-07-15 11:55:43 UTC (rev 131802)
@@ -0,0 +1,18 @@
+# Description: Do not count system inodes into quota for ext[234]
+# Author: Jan Kara
+
+--- quota/quotacheck.c 2010-02-18 09:44:10.000000000 +0100
++++ quota-tools//quotacheck.c 2010-05-22 16:47:53.000000000 +0200
+@@ -455,8 +455,10 @@
+ return -1;
+ }
+
+- while ((long)i_num) {
+- if (inode.i_links_count) {
++ while (i_num) {
++ if ((i_num == EXT2_ROOT_INO ||
++ i_num >= EXT2_FIRST_INO(fs->super)) &&
++ inode.i_links_count) {
+ debug(FL_DEBUG, _("Found i_num %ld, blocks %ld\n"), (long)i_num, (long)inode.i_blocks);
+ if (flags & FL_VERBOSE)
+ blit(NULL);
More information about the arch-commits
mailing list