* [PATCH 1/5] Update the gitignore file to ignore additional generated files
2016-03-30 0:48 [PATCH 0/5] Misc. cleanup and portability patches for quota-tools Theodore Ts'o
@ 2016-03-30 0:48 ` Theodore Ts'o
2016-03-30 0:48 ` [PATCH 2/5] Allow building on systems that do not have rpc header files Theodore Ts'o
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Theodore Ts'o @ 2016-03-30 0:48 UTC (permalink / raw)
To: jack; +Cc: Linux Filesystem Development List, Theodore Ts'o
Ignore the files generated by libtool, gettext, and rpcgen
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
.gitignore | 3 +++
1 file changed, 3 insertions(+)
diff --git a/.gitignore b/.gitignore
index 961387a..de81510 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,6 +9,7 @@ missing
*~
*.swp
*.bak
+.*.d
config.h
config.h.in
config.log
@@ -31,6 +32,8 @@ rquota.h
rquota_clnt.c
convertquota
edquota
+po/*.mo
+rquota_xdr.c
quot
quota
quotacheck
--
2.5.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/5] Allow building on systems that do not have rpc header files
2016-03-30 0:48 [PATCH 0/5] Misc. cleanup and portability patches for quota-tools Theodore Ts'o
2016-03-30 0:48 ` [PATCH 1/5] Update the gitignore file to ignore additional generated files Theodore Ts'o
@ 2016-03-30 0:48 ` Theodore Ts'o
2016-03-30 0:48 ` [PATCH 3/5] Use NGROUPS_MAX instead of NGROUPS Theodore Ts'o
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Theodore Ts'o @ 2016-03-30 0:48 UTC (permalink / raw)
To: jack; +Cc: Linux Filesystem Development List, Theodore Ts'o
Android's bionic C library doesn't have Sun RPC support.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
Makefile.am | 38 ++++++++++++++++++++++----------------
quotaops.c | 2 ++
setquota.c | 2 ++
3 files changed, 26 insertions(+), 16 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 77f8400..6018fe8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,8 +1,6 @@
ACLOCAL_AMFLAGS = -I m4
AM_LDFLAGS = -pie
-BUILT_SOURCES = rquota.h rquota.c rquota_clnt.c
-
doc_DATA = \
README.mailserver \
README.ldap-support \
@@ -12,11 +10,6 @@ doc_DATA = \
doc/quotas.preformated \
doc/quotas-1.eps
-rpcsvcdir = $(includedir)/rpcsvc
-rpcsvc_DATA = \
- rquota.h \
- rquota.x
-
sysconf_DATA = \
warnquota.conf \
quotatab \
@@ -35,15 +28,12 @@ man_MANS = \
quota.1 \
quot.8 \
repquota.8 \
- rpc.rquotad.8 \
rquota.3 \
setquota.8 \
warnquota.conf.5 \
warnquota.8 \
xqmstats.8
-CLEANFILES = rquota.c rquota.h rquota_clnt.c
-
SUBDIRS = po
EXTRA_DIST = \
@@ -55,9 +45,15 @@ EXTRA_DIST = \
Changelog \
ldap-scripts
-noinst_LIBRARIES = \
- libquota.a \
- librpcclient.a
+noinst_LIBRARIES = libquota.a
+
+if WITH_RPC
+rpcsvcdir = $(includedir)/rpcsvc
+rpcsvc_DATA = \
+ rquota.h \
+ rquota.x
+
+noinst_LIBRARIES += librpcclient.a
librpcclient_a_SOURCES = \
rquota.c \
@@ -67,8 +63,10 @@ librpcclient_a_SOURCES = \
rquota_clnt.c
librpcclient_a_CFLAGS = -Wno-unused
-if WITH_RPC
RPCLIBS = librpcclient.a
+BUILT_SOURCES = rquota.h rquota.c rquota_clnt.c
+CLEANFILES = rquota.c rquota.h rquota_clnt.c
+man_MANS += rpc.rquotad.8
endif
libquota_a_SOURCES = \
@@ -116,12 +114,16 @@ sbin_PROGRAMS = \
xqmstats \
edquota \
setquota \
- convertquota \
- rpc.rquotad
+ convertquota
if WITH_NETLINK
sbin_PROGRAMS += \
quota_nld
endif
+if WITH_RPC
+sbin_PROGRAMS += \
+ rpc.rquotad
+endif
+
quotaon_SOURCES = \
quotaon.c \
@@ -214,6 +216,7 @@ convertquota_LDADD = \
libquota.a \
$(RPCLIBS)
+if WITH_RPC
rpc_rquotad_SOURCES = \
rquota_server.c \
rquota_svc.c \
@@ -222,6 +225,7 @@ rpc_rquotad_LDADD = \
libquota.a \
$(WRAP_LIBS) \
$(RPCLIBS)
+endif
quota_nld_SOURCES = quota_nld.c
quota_nld_CFLAGS = \
@@ -233,6 +237,7 @@ quota_nld_LDADD = \
$(DBUS_LIBS) \
$(LIBNL3_LIBS)
+if WITH_RPC
# ------------------
# Rpcgen conversions
# ------------------
@@ -247,6 +252,7 @@ quota_nld_LDADD = \
rquota_clnt.c: rquota.x
@rm -f $@
@$(RPCGEN) -l -o $@ $<
+endif
# --------
# Quotaoff
diff --git a/quotaops.c b/quotaops.c
index 47ef9a7..136aec3 100644
--- a/quotaops.c
+++ b/quotaops.c
@@ -34,7 +34,9 @@
#include "config.h"
+#if defined(RPC)
#include <rpc/rpc.h>
+#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/file.h>
diff --git a/setquota.c b/setquota.c
index 37f577f..d50aadb 100644
--- a/setquota.c
+++ b/setquota.c
@@ -7,7 +7,9 @@
#include "config.h"
+#if defined(RPC)
#include <rpc/rpc.h>
+#endif
#include <sys/types.h>
#include <errno.h>
#include <stdio.h>
--
2.5.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/5] Use NGROUPS_MAX instead of NGROUPS
2016-03-30 0:48 [PATCH 0/5] Misc. cleanup and portability patches for quota-tools Theodore Ts'o
2016-03-30 0:48 ` [PATCH 1/5] Update the gitignore file to ignore additional generated files Theodore Ts'o
2016-03-30 0:48 ` [PATCH 2/5] Allow building on systems that do not have rpc header files Theodore Ts'o
@ 2016-03-30 0:48 ` Theodore Ts'o
2016-03-30 0:48 ` [PATCH 4/5] Provide fallback definitions for MNTTYPE_NFS and MNTTYPE_NOAUTO Theodore Ts'o
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Theodore Ts'o @ 2016-03-30 0:48 UTC (permalink / raw)
To: jack; +Cc: Linux Filesystem Development List, Theodore Ts'o
NGRROUPS_MAX is what is defined by SuSv3; NGROUPS is not guaranteed by
any standard, but is just an ancient BSD'ism. Since Android's bionic
libc has the former but not the latter, let's use NGROUPS_MAX instead.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
quota.c | 5 +++--
quotaops.c | 5 +++--
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/quota.c b/quota.c
index d3ab800..da66a46 100644
--- a/quota.c
+++ b/quota.c
@@ -48,6 +48,7 @@
#include <errno.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#ifdef RPC
#include <rpc/rpc.h>
#include "rquota.h"
@@ -298,7 +299,7 @@ static int showquotas(int type, qid_t id, int mntcnt, char **mnt)
int main(int argc, char **argv)
{
int ngroups;
- gid_t gidset[NGROUPS], *gidsetp;
+ gid_t gidset[NGROUPS_MAX], *gidsetp;
int i, ret, type = 0;
struct option long_opts[] = {
{ "help", 0, NULL, 'h' },
@@ -411,7 +412,7 @@ int main(int argc, char **argv)
ret |= showquotas(USRQUOTA, getuid(), argc, argv);
if (flags & FL_GROUP) {
ngroups = sysconf(_SC_NGROUPS_MAX);
- if (ngroups > NGROUPS) {
+ if (ngroups > NGROUPS_MAX) {
gidsetp = malloc(ngroups * sizeof(gid_t));
if (!gidsetp)
die(1, _("Gid set allocation (%d): %s\n"), ngroups, strerror(errno));
diff --git a/quotaops.c b/quotaops.c
index 136aec3..590dc1b 100644
--- a/quotaops.c
+++ b/quotaops.c
@@ -51,6 +51,7 @@
#include <unistd.h>
#include <time.h>
#include <ctype.h>
+#include <limits.h>
#if defined(RPC)
#include "rquota.h"
@@ -97,7 +98,7 @@ struct dquot *getprivs(qid_t id, struct quota_handle **handles, int quiet)
#if defined(BSD_BEHAVIOUR)
int j, ngroups;
uid_t euid;
- gid_t gidset[NGROUPS], *gidsetp;
+ gid_t gidset[NGROUPS_MAX], *gidsetp;
#endif
for (i = 0; handles[i]; i++) {
@@ -115,7 +116,7 @@ struct dquot *getprivs(qid_t id, struct quota_handle **handles, int quiet)
if (geteuid() == 0)
break;
ngroups = sysconf(_SC_NGROUPS_MAX);
- if (ngroups > NGROUPS) {
+ if (ngroups > NGROUPS_MAX) {
gidsetp = malloc(ngroups * sizeof(gid_t));
if (!gidsetp) {
gid2group(id, name);
--
2.5.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/5] Provide fallback definitions for MNTTYPE_NFS and MNTTYPE_NOAUTO
2016-03-30 0:48 [PATCH 0/5] Misc. cleanup and portability patches for quota-tools Theodore Ts'o
` (2 preceding siblings ...)
2016-03-30 0:48 ` [PATCH 3/5] Use NGROUPS_MAX instead of NGROUPS Theodore Ts'o
@ 2016-03-30 0:48 ` Theodore Ts'o
2016-03-30 0:48 ` [PATCH 5/5] Support systems which do not have nl_langinfo() Theodore Ts'o
2016-03-30 8:29 ` [PATCH 0/5] Misc. cleanup and portability patches for quota-tools Jan Kara
5 siblings, 0 replies; 7+ messages in thread
From: Theodore Ts'o @ 2016-03-30 0:48 UTC (permalink / raw)
To: jack; +Cc: Linux Filesystem Development List, Theodore Ts'o
Not all C library's /usr/include/mntent.h are guaranteed to define
MNTTYPE_NFS and MNTTYPE_AUTO. Since we already are defining a large
number of MNTTYPE_* macros for our own use in mntopt.h, add fallback
definitions for MNTTYPE_NFS and MNTTYPE_NOAUTO there.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
mntopt.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/mntopt.h b/mntopt.h
index a70b4a4..3b33879 100644
--- a/mntopt.h
+++ b/mntopt.h
@@ -21,6 +21,10 @@
#define MNTTYPE_OCFS2 "ocfs2" /* Oracle Cluster filesystem */
#define MNTTYPE_GFS2 "gfs2" /* Red Hat Global filesystem 2 */
+#ifndef MNTTYPE_NFS
+#define MNTTYPE_NFS "nfs" /* Network file system. */
+#endif
+
/* mount options */
#define MNTOPT_NOQUOTA "noquota" /* don't enforce quota */
#define MNTOPT_QUOTA "quota" /* enforce user quota */
@@ -34,4 +38,8 @@
#define MNTOPT_LOOP "loop" /* loopback mount */
#define MNTOPT_JQFMT "jqfmt" /* journaled quota format */
+#ifndef MNTOPT_NOAUTO
+#define MNTOPT_NOAUTO "noauto" /* Do not auto mount. */
+#endif
+
#endif
--
2.5.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 5/5] Support systems which do not have nl_langinfo()
2016-03-30 0:48 [PATCH 0/5] Misc. cleanup and portability patches for quota-tools Theodore Ts'o
` (3 preceding siblings ...)
2016-03-30 0:48 ` [PATCH 4/5] Provide fallback definitions for MNTTYPE_NFS and MNTTYPE_NOAUTO Theodore Ts'o
@ 2016-03-30 0:48 ` Theodore Ts'o
2016-03-30 8:29 ` [PATCH 0/5] Misc. cleanup and portability patches for quota-tools Jan Kara
5 siblings, 0 replies; 7+ messages in thread
From: Theodore Ts'o @ 2016-03-30 0:48 UTC (permalink / raw)
To: jack; +Cc: Linux Filesystem Development List, Theodore Ts'o
Add a configure check and skip use of nl_langinfo if it is not
present.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
configure.ac | 1 +
warnquota.c | 4 ++++
2 files changed, 5 insertions(+)
diff --git a/configure.ac b/configure.ac
index d17b18c..0d0ba57 100644
--- a/configure.ac
+++ b/configure.ac
@@ -32,6 +32,7 @@ PKG_PROG_PKG_CONFIG([0.20])
AC_C_CONST
AC_C_INLINE
+AC_CHECK_FUNC(nl_langinfo)
# ===============
# Gettext support
diff --git a/warnquota.c b/warnquota.c
index e9868c1..0d911e4 100644
--- a/warnquota.c
+++ b/warnquota.c
@@ -30,7 +30,9 @@
#include <time.h>
#include <getopt.h>
#include <locale.h>
+#ifdef HAVE_NL_LANGINFO
#include <langinfo.h>
+#endif
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/utsname.h>
@@ -723,10 +725,12 @@ static int readconfigfile(const char *filename, struct configparams *config)
(config->charset)[0] = '\0';
setlocale(LC_ALL, NULL);
locale = setlocale(LC_MESSAGES, NULL);
+#ifdef HAVE_NL_LANGINFO
if (locale && strcasecmp(locale, "posix") && strcasecmp(locale, "c")) {
locale = nl_langinfo(CODESET);
sstrncpy(config->charset, locale, CNF_BUFFER);
}
+#endif
maildev[0] = 0;
config->user_signature = config->user_message = config->group_signature = config->group_message = NULL;
config->cc_before = -1;
--
2.5.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 0/5] Misc. cleanup and portability patches for quota-tools
2016-03-30 0:48 [PATCH 0/5] Misc. cleanup and portability patches for quota-tools Theodore Ts'o
` (4 preceding siblings ...)
2016-03-30 0:48 ` [PATCH 5/5] Support systems which do not have nl_langinfo() Theodore Ts'o
@ 2016-03-30 8:29 ` Jan Kara
5 siblings, 0 replies; 7+ messages in thread
From: Jan Kara @ 2016-03-30 8:29 UTC (permalink / raw)
To: Theodore Ts'o; +Cc: jack, Linux Filesystem Development List
Hi Ted,
On Tue 29-03-16 20:48:02, Ted Tso wrote:
> Here are some patches that provide some additional compatibility for
> quota-tools package.
>
> No, this isn't quite enough to allow quota-tools to build for
> Android/Bionic. These changes are sufficient to allow things to
> build, but there are still a few missing functions, most notably a
> syscall wrapper for quotactl(2), that are missing and which I'll add
> to a compatibility library in xfstests-bld, and/or get upstream into
> the Bionic libc at some point, if I can.
>
> I think these changes are generally useful, though. For example, with
> glibc on x86, if you try to do a build after configuring with
> --enable-rpc=no, the result is a huge number of build failures. This
> patch series will fix things so we can compile without rpc support.
Thanks for the fixes! I have merged them all. I had to slightly fix
nl_langinfo() checking so that HAVE_NL_LANGINFO is really defined in case
we have nl_langinfo() but it was easy enough.
I have also added explicit includes of stdlib.h into some files as
otherwise compilation without RPC emitted some warnings.
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 7+ messages in thread