From 60d33496e097afc161e9ce949bb92ad6f3942619 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Mon, 19 Jan 2015 13:59:55 +0300 Subject: nfs-utils scm build --- net-fs/nfs-utils/files/exports | 1 + .../nfs-utils/files/nfs-utils-1.1.4-mtab-sym.patch | 39 +++++ .../files/nfs-utils-1.2.8-cross-build.patch | 48 ++++++ .../nfs-utils/files/nfs-utils-1.3.0-gcc-4.9.patch | 62 ++++++++ net-fs/nfs-utils/files/nfs-utils.conf | 3 + net-fs/nfs-utils/files/nfs.confd | 38 +++++ net-fs/nfs-utils/files/nfs.initd | 163 +++++++++++++++++++ net-fs/nfs-utils/files/nfsclient.confd | 7 + net-fs/nfs-utils/files/nfsclient.initd | 39 +++++ net-fs/nfs-utils/files/nfsd.service-r1 | 15 ++ net-fs/nfs-utils/files/nfsmount.confd | 7 + net-fs/nfs-utils/files/nfsmount.initd | 48 ++++++ net-fs/nfs-utils/files/proc-fs-nfsd.mount | 8 + net-fs/nfs-utils/files/rpc-gssd.service | 12 ++ net-fs/nfs-utils/files/rpc-idmapd.service | 11 ++ net-fs/nfs-utils/files/rpc-mountd.service-r1 | 10 ++ net-fs/nfs-utils/files/rpc-statd.service-r2 | 12 ++ net-fs/nfs-utils/files/rpc-svcgssd.service | 13 ++ net-fs/nfs-utils/files/rpc.gssd.initd | 24 +++ net-fs/nfs-utils/files/rpc.idmapd.initd | 26 ++++ net-fs/nfs-utils/files/rpc.pipefs.initd | 33 ++++ net-fs/nfs-utils/files/rpc.statd.initd | 33 ++++ net-fs/nfs-utils/files/rpc.svcgssd.initd | 24 +++ .../nfs-utils/files/var-lib-nfs-rpc_pipefs.mount | 7 + net-fs/nfs-utils/nfs-utils-scm.ebuild | 173 +++++++++++++++++++++ 25 files changed, 856 insertions(+) create mode 100644 net-fs/nfs-utils/files/exports create mode 100644 net-fs/nfs-utils/files/nfs-utils-1.1.4-mtab-sym.patch create mode 100644 net-fs/nfs-utils/files/nfs-utils-1.2.8-cross-build.patch create mode 100644 net-fs/nfs-utils/files/nfs-utils-1.3.0-gcc-4.9.patch create mode 100644 net-fs/nfs-utils/files/nfs-utils.conf create mode 100644 net-fs/nfs-utils/files/nfs.confd create mode 100755 net-fs/nfs-utils/files/nfs.initd create mode 100644 net-fs/nfs-utils/files/nfsclient.confd create mode 100644 net-fs/nfs-utils/files/nfsclient.initd create mode 100644 net-fs/nfs-utils/files/nfsd.service-r1 create mode 100644 net-fs/nfs-utils/files/nfsmount.confd create mode 100755 net-fs/nfs-utils/files/nfsmount.initd create mode 100644 net-fs/nfs-utils/files/proc-fs-nfsd.mount create mode 100644 net-fs/nfs-utils/files/rpc-gssd.service create mode 100644 net-fs/nfs-utils/files/rpc-idmapd.service create mode 100644 net-fs/nfs-utils/files/rpc-mountd.service-r1 create mode 100644 net-fs/nfs-utils/files/rpc-statd.service-r2 create mode 100644 net-fs/nfs-utils/files/rpc-svcgssd.service create mode 100755 net-fs/nfs-utils/files/rpc.gssd.initd create mode 100755 net-fs/nfs-utils/files/rpc.idmapd.initd create mode 100644 net-fs/nfs-utils/files/rpc.pipefs.initd create mode 100755 net-fs/nfs-utils/files/rpc.statd.initd create mode 100755 net-fs/nfs-utils/files/rpc.svcgssd.initd create mode 100644 net-fs/nfs-utils/files/var-lib-nfs-rpc_pipefs.mount create mode 100644 net-fs/nfs-utils/nfs-utils-scm.ebuild diff --git a/net-fs/nfs-utils/files/exports b/net-fs/nfs-utils/files/exports new file mode 100644 index 0000000..5102ef2 --- /dev/null +++ b/net-fs/nfs-utils/files/exports @@ -0,0 +1 @@ +# /etc/exports: NFS file systems being exported. See exports(5). diff --git a/net-fs/nfs-utils/files/nfs-utils-1.1.4-mtab-sym.patch b/net-fs/nfs-utils/files/nfs-utils-1.1.4-mtab-sym.patch new file mode 100644 index 0000000..c9e60af --- /dev/null +++ b/net-fs/nfs-utils/files/nfs-utils-1.1.4-mtab-sym.patch @@ -0,0 +1,39 @@ +ripped from Debian + +--- nfs-utils-1.1.4/utils/mount/fstab.c ++++ nfs-utils-1.1.4/utils/mount/fstab.c +@@ -57,7 +57,7 @@ mtab_does_not_exist(void) { + return var_mtab_does_not_exist; + } + +-static int ++int + mtab_is_a_symlink(void) { + get_mtab_info(); + return var_mtab_is_a_symlink; +--- nfs-utils-1.1.4/utils/mount/fstab.h ++++ nfs-utils-1.1.4/utils/mount/fstab.h +@@ -7,6 +7,7 @@ + #define _PATH_FSTAB "/etc/fstab" + #endif + ++int mtab_is_a_symlink(void); + int mtab_is_writable(void); + int mtab_does_not_exist(void); + void reset_mtab_info(void); +--- nfs-utils-1.1.4/utils/mount/mount.c ++++ nfs-utils-1.1.4/utils/mount/mount.c +@@ -230,6 +230,13 @@ create_mtab (void) { + int flags; + mntFILE *mfp; + ++ /* Avoid writing if the mtab is a symlink to /proc/mounts, since ++ that would create a file /proc/mounts in case the proc filesystem ++ is not mounted, and the fchmod below would also fail. */ ++ if (mtab_is_a_symlink()) { ++ return EX_SUCCESS; ++ } ++ + lock_mtab(); + + mfp = nfs_setmntent (MOUNTED, "a+"); diff --git a/net-fs/nfs-utils/files/nfs-utils-1.2.8-cross-build.patch b/net-fs/nfs-utils/files/nfs-utils-1.2.8-cross-build.patch new file mode 100644 index 0000000..7317115 --- /dev/null +++ b/net-fs/nfs-utils/files/nfs-utils-1.2.8-cross-build.patch @@ -0,0 +1,48 @@ +this is kind of hacky, but automake doesn't make this easy +for us atm, so hack away :( + +(recent autotools will always add $(CFLAGS)/etc... to the compile) + +--- a/tools/locktest/Makefile.am ++++ b/tools/locktest/Makefile.am +@@ -1,12 +1,11 @@ + ## Process this file with automake to produce Makefile.in + + CC=$(CC_FOR_BUILD) +-LIBTOOL = @LIBTOOL@ --tag=CC ++CFLAGS=$(CFLAGS_FOR_BUILD) ++CPPFLAGS=$(CPPFLAGS_FOR_BUILD) ++LDFLAGS=$(LDFLAGS_FOR_BUILD) + + noinst_PROGRAMS = testlk + testlk_SOURCES = testlk.c +-testlk_CFLAGS=$(CFLAGS_FOR_BUILD) +-testlk_CPPFLAGS=$(CPPFLAGS_FOR_BUILD) +-testlk_LDFLAGS=$(LDFLAGS_FOR_BUILD) + + MAINTAINERCLEANFILES = Makefile.in +--- a/tools/rpcgen/Makefile.am ++++ b/tools/rpcgen/Makefile.am +@@ -1,7 +1,9 @@ + ## Process this file with automake to produce Makefile.in + + CC=$(CC_FOR_BUILD) +-LIBTOOL = @LIBTOOL@ --tag=CC ++CFLAGS=$(CFLAGS_FOR_BUILD) ++CPPFLAGS=$(CPPFLAGS_FOR_BUILD) ++LDFLAGS=$(LDFLAGS_FOR_BUILD) + + noinst_PROGRAMS = rpcgen + rpcgen_SOURCES = rpc_clntout.c rpc_cout.c rpc_hout.c rpc_main.c \ +@@ -9,10 +11,6 @@ + rpc_util.c rpc_sample.c rpc_output.h rpc_parse.h \ + rpc_scan.h rpc_util.h + +-rpcgen_CFLAGS=$(CFLAGS_FOR_BUILD) +-rpcgen_CPPLAGS=$(CPPFLAGS_FOR_BUILD) +-rpcgen_LDFLAGS=$(LDFLAGS_FOR_BUILD) +-rpcgen_LDADD=$(LIBTIRPC) + + MAINTAINERCLEANFILES = Makefile.in + + EXTRA_DIST = rpcgen.new.1 diff --git a/net-fs/nfs-utils/files/nfs-utils-1.3.0-gcc-4.9.patch b/net-fs/nfs-utils/files/nfs-utils-1.3.0-gcc-4.9.patch new file mode 100644 index 0000000..e2d98b5 --- /dev/null +++ b/net-fs/nfs-utils/files/nfs-utils-1.3.0-gcc-4.9.patch @@ -0,0 +1,62 @@ +From 25e83c2270b2d2966c992885faed0b79be09f474 Mon Sep 17 00:00:00 2001 +From: Jeff Layton +Date: Thu, 1 May 2014 11:15:16 -0400 +Subject: [PATCH [nfs-utils]] mountd: fix segfault in add_name with newer gcc + compilers + +I hit a segfault in add_name with a mountd built with gcc-4.9.0. Some +NULL pointer checks got reordered such that a pointer was dereferenced +before checking to see whether it was NULL. The problem was due to +nfs-utils relying on undefined behavior, which tricked gcc into assuming +that the pointer would never be NULL. + +At first I assumed that this was a compiler bug, but Jakub Jelinek and +Jeff Law pointed out: + +"If old is NULL, then: + + strncpy(new, old, cp-old); + +is undefined behavior (even when cp == old == NULL in that case), +therefore gcc assumes that old is never NULL, as otherwise it would be +invalid. + +Just guard + strncpy(new, old, cp-old); + new[cp-old] = 0; +with if (old) { ... }." + +This patch does that. If old is NULL though, then we still need to +ensure that new is NULL terminated, lest the subsequent strcats walk off +the end of it. + +Cc: Jeff Law +Cc: Jakub Jelinek +Signed-off-by: Jeff Layton +Signed-off-by: Steve Dickson +--- + support/export/client.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/support/export/client.c b/support/export/client.c +index dbf47b9..f85e11c 100644 +--- a/support/export/client.c ++++ b/support/export/client.c +@@ -482,8 +482,12 @@ add_name(char *old, const char *add) + else + cp = cp + strlen(cp); + } +- strncpy(new, old, cp-old); +- new[cp-old] = 0; ++ if (old) { ++ strncpy(new, old, cp-old); ++ new[cp-old] = 0; ++ } else { ++ new[0] = 0; ++ } + if (cp != old && !*cp) + strcat(new, ","); + strcat(new, add); +-- +2.0.0 + diff --git a/net-fs/nfs-utils/files/nfs-utils.conf b/net-fs/nfs-utils/files/nfs-utils.conf new file mode 100644 index 0000000..b9b586c --- /dev/null +++ b/net-fs/nfs-utils/files/nfs-utils.conf @@ -0,0 +1,3 @@ +d /var/lib/nfs/rpc_pipefs +d /var/lib/nfs/v4recovery +d /var/lib/nfs/v4root diff --git a/net-fs/nfs-utils/files/nfs.confd b/net-fs/nfs-utils/files/nfs.confd new file mode 100644 index 0000000..d493400 --- /dev/null +++ b/net-fs/nfs-utils/files/nfs.confd @@ -0,0 +1,38 @@ +# /etc/conf.d/nfs + +# If you wish to set the port numbers for lockd, +# please see /etc/sysctl.conf + +# Optional services to include in default `/etc/init.d/nfs start` +# For NFSv4 users, you'll want to add "rpc.idmapd" here. +NFS_NEEDED_SERVICES="" + +# Number of servers to be started up by default +OPTS_RPC_NFSD="8" + +# Options to pass to rpc.mountd +# ex. OPTS_RPC_MOUNTD="-p 32767" +OPTS_RPC_MOUNTD="" + +# Options to pass to rpc.statd +# ex. OPTS_RPC_STATD="-p 32765 -o 32766" +OPTS_RPC_STATD="" + +# Options to pass to rpc.idmapd +OPTS_RPC_IDMAPD="" + +# Options to pass to rpc.gssd +OPTS_RPC_GSSD="" + +# Options to pass to rpc.svcgssd +OPTS_RPC_SVCGSSD="" + +# Options to pass to rpc.rquotad (requires sys-fs/quota) +OPTS_RPC_RQUOTAD="" + +# Timeout (in seconds) for exportfs +EXPORTFS_TIMEOUT=30 + +# Options to set in the nfsd filesystem (/proc/fs/nfsd/). +# Format is