commit:     75195b7d6c7532b8aa5acd8b9a27fc6ad4555548
Author:     Dave Hughes <davidhughes205 <AT> gmail <DOT> com>
AuthorDate: Tue Jun  1 02:20:33 2021 +0000
Commit:     Dave Hughes <davidhughes205 <AT> gmail <DOT> com>
CommitDate: Tue Jun  1 02:20:33 2021 +0000
URL:        https://gitweb.gentoo.org/proj/musl.git/commit/?id=75195b7d

net-fs/nfs-utils: sync with ::gentoo

Package-Manager: Portage-3.0.19, Repoman-3.0.3
Signed-off-by: Dave Hughes <davidhughes205 <AT> gmail.com>

 net-fs/nfs-utils/Manifest                          |   4 +-
 net-fs/nfs-utils/files/musl-getservbyport.patch    |  18 ++
 net-fs/nfs-utils/files/musl-svcgssd-sysconf.patch  | 144 ++++++++++++++++
 net-fs/nfs-utils/files/musl-time64.patch           |  51 ++++++
 .../nfs-utils/files/nfs-utils-1.1.4-mtab-sym.patch |  39 -----
 .../files/nfs-utils-1.2.8-cross-build.patch        |  48 ------
 ...s-utils-2.3.1-svcgssd_undefined_reference.patch |  40 -----
 .../files/nfs-utils-2.3.2-junction_libs.patch      |  45 -----
 ...utils-2.4.2-Ensure-consistent-struct-stat.patch | 115 +++++++++++++
 ...error.patch => nfs-utils-2.5.2-no-werror.patch} |  29 +++-
 net-fs/nfs-utils/files/nfs-utils-musl.patch        | 147 ----------------
 net-fs/nfs-utils/files/nfs-utils.conf              |   3 -
 net-fs/nfs-utils/files/nfs.initd                   |  12 +-
 net-fs/nfs-utils/files/nfsmount.confd              |   7 -
 net-fs/nfs-utils/files/nfsmount.initd              |  47 ------
 net-fs/nfs-utils/metadata.xml                      |   1 -
 net-fs/nfs-utils/nfs-utils-1.3.4-r1.ebuild         | 182 --------------------
 net-fs/nfs-utils/nfs-utils-2.3.1-r3.ebuild         | 187 ---------------------
 ...tils-2.3.3.ebuild => nfs-utils-2.5.3-r1.ebuild} |  91 ++++++----
 19 files changed, 410 insertions(+), 800 deletions(-)

diff --git a/net-fs/nfs-utils/Manifest b/net-fs/nfs-utils/Manifest
index 3196928..0ae2ec8 100644
--- a/net-fs/nfs-utils/Manifest
+++ b/net-fs/nfs-utils/Manifest
@@ -1,3 +1 @@
-DIST nfs-utils-1.3.4.tar.bz2 814545 BLAKE2B 
4b8c5fa4c1c21858e19d05f973c6d94185cf6a15c88348dda5e47c6714f9dba00dfa05237d908479970440b2ea57287600e92cb4d49872127b3801e075d6bf1a
 SHA512 
765c0bc55a9a0bdb2c25d8fb7189a9054fb9f2dd51726eda29f44e5d5c423e245b02307dfcfab9239276d8f44869a72732416f6e9ef5a1f80753d9243ba1b38c
-DIST nfs-utils-2.3.1.tar.bz2 854899 BLAKE2B 
f9541b9dc103d978f21d57d8ba0c14a3b30f6ba874b112239d014076c1c72b6654e8e02b4bfea686e658dac84d1e896b872bc2054591275ef1713ae4e7b7d005
 SHA512 
de3e70f8656bc5b5aa98262685a9e80929c6314234d9bbb74d4c7efcb7a8b2640d48d2100850b403157ebefc8f0eb48598b48238fae795f64c7a0e9a8bff93e3
-DIST nfs-utils-2.3.3.tar.bz2 888947 BLAKE2B 
7c913f0c5061807d4af162fb392c8f466abb97c88960853b52298f61056bcad08f67a16e577036dec9afa737d88268d5a766b67c4b30a014b666dfbf3db81031
 SHA512 
266b86ef5041a7ecd144c6f2570e8a6eb00ebb4e547fa4b8c8c3e60a4af117c2690ff9effb0d4113a7b7ef57164583c8a6ada9cb1bb8f7b748524c826eaf1cba
+DIST nfs-utils-2.5.3.tar.bz2 937544 BLAKE2B 
817af2c302cf110519e64353a507645137ffd3b93b46eb94e71d45a1869c9e831e344f0baa33b1b39514962798cca542cf56a2830520c67e96e78995f2bf901f
 SHA512 
3be82f42c5da2bbbca4429459c858c58ae7333725749213c824d0c01b78f0beb7384455f314fc1cc1799968f9f40fd616297c7baf3514ca0e31d4686e9d6e732

diff --git a/net-fs/nfs-utils/files/musl-getservbyport.patch 
b/net-fs/nfs-utils/files/musl-getservbyport.patch
new file mode 100644
index 0000000..6fa589c
--- /dev/null
+++ b/net-fs/nfs-utils/files/musl-getservbyport.patch
@@ -0,0 +1,18 @@
+Musl will always return something with getservbyport so we cannot skip
+ports that returns non-null.
+
+diff --git a/utils/statd/rmtcall.c b/utils/statd/rmtcall.c
+index fd576d9..d72a0bf 100644
+--- a/utils/statd/rmtcall.c
++++ b/utils/statd/rmtcall.c
+@@ -93,8 +93,10 @@
+                                       __func__);
+                       break;
+               }
++#if 0
+               se = getservbyport(sin.sin_port, "udp");
+               if (se == NULL)
++#endif
+                       break;
+ 
+               if (retries == MAX_BRP_RETRIES) {

diff --git a/net-fs/nfs-utils/files/musl-svcgssd-sysconf.patch 
b/net-fs/nfs-utils/files/musl-svcgssd-sysconf.patch
new file mode 100644
index 0000000..ec280cc
--- /dev/null
+++ b/net-fs/nfs-utils/files/musl-svcgssd-sysconf.patch
@@ -0,0 +1,144 @@
+--- a/support/nfsidmap/libnfsidmap.c
++++ b/support/nfsidmap/libnfsidmap.c
+@@ -432,11 +432,17 @@ int nfs4_init_name_mapping(char *conffil
+ 
+       nobody_user = conf_get_str("Mapping", "Nobody-User");
+       if (nobody_user) {
+-              size_t buflen = sysconf(_SC_GETPW_R_SIZE_MAX);
++              long scbuflen = sysconf(_SC_GETPW_R_SIZE_MAX);
++              size_t buflen = 1024; /*value on my gentoo glibc system that 
has _SC_GETPW_R_SIZE_MAX*/
+               struct passwd *buf;
+               struct passwd *pw = NULL;
+               int err;
+ 
++              /*sysconf can return -1 when _SC_GETPW_R_SIZE_MAX is not 
defined, like on musl systems, if cast to size_t this will lead
++                to an integer overflow, which leads to a buffer overflow and 
crashes svcgssd */
++              if (scbuflen > 0)
++                      buflen = (size_t)scbuflen;
++
+               buf = malloc(sizeof(*buf) + buflen);
+               if (buf) {
+                       err = getpwnam_r(nobody_user, buf, ((char *)buf) + 
sizeof(*buf), buflen, &pw);
+@@ -453,11 +459,17 @@ int nfs4_init_name_mapping(char *conffil
+ 
+       nobody_group = conf_get_str("Mapping", "Nobody-Group");
+       if (nobody_group) {
+-              size_t buflen = sysconf(_SC_GETGR_R_SIZE_MAX);
++              long scbuflen = sysconf(_SC_GETGR_R_SIZE_MAX);
++              size_t buflen = 1024; /*value on my gentoo glibc system that 
has _SC_GETGR_R_SIZE_MAX*/
+               struct group *buf;
+               struct group *gr = NULL;
+               int err;
+ 
++              /*sysconf can return -1 when _SC_GETGR_R_SIZE_MAX is not 
defined, like on musl systems, if cast to size_t this will lead
++                to an integer overflow, which leads to a buffer overflow and 
crashes svcgssd */
++              if (scbuflen > 0)
++                      buflen = (size_t)scbuflen;
++
+               buf = malloc(sizeof(*buf) + buflen);
+               if (buf) {
+                       err = getgrnam_r(nobody_group, buf, ((char *)buf) + 
sizeof(*buf), buflen, &gr);
+--- a/support/nfsidmap/static.c
++++ b/support/nfsidmap/static.c
+@@ -98,10 +98,14 @@ static struct passwd *static_getpwnam(co
+ {
+       struct passwd *pw;
+       struct pwbuf *buf;
+-      size_t buflen = sysconf(_SC_GETPW_R_SIZE_MAX);
++      long scbuflen = sysconf(_SC_GETPW_R_SIZE_MAX);
++      size_t buflen = 1024;
+       char *localname;
+       int err;
+ 
++      if (scbuflen > 0)
++              buflen = (size_t)scbuflen;
++
+       buf = malloc(sizeof(*buf) + buflen);
+       if (!buf) {
+               err = ENOMEM;
+@@ -149,10 +153,14 @@ static struct group *static_getgrnam(con
+ {
+       struct group *gr;
+       struct grbuf *buf;
+-      size_t buflen = sysconf(_SC_GETGR_R_SIZE_MAX);
++      long scbuflen = sysconf(_SC_GETGR_R_SIZE_MAX);
++      size_t buflen = 1024;
+       char *localgroup;
+       int err;
+ 
++      if (scbuflen > 0)
++              buflen = (size_t)scbuflen;
++
+       buf = malloc(sizeof(*buf) + buflen);
+       if (!buf) {
+               err = ENOMEM;
+--- a/support/nfsidmap/nss.c
++++ b/support/nfsidmap/nss.c
+@@ -91,9 +91,13 @@ static int nss_uid_to_name(uid_t uid, ch
+       struct passwd *pw = NULL;
+       struct passwd pwbuf;
+       char *buf;
+-      size_t buflen = sysconf(_SC_GETPW_R_SIZE_MAX);
++      long scbuflen = sysconf(_SC_GETPW_R_SIZE_MAX);
++      size_t buflen = 1024;
+       int err = -ENOMEM;
+ 
++      if (scbuflen > 0)
++              buflen = (size_t)scbuflen;
++
+       buf = malloc(buflen);
+       if (!buf)
+               goto out;
+@@ -119,9 +123,13 @@ static int nss_gid_to_name(gid_t gid, ch
+       struct group *gr = NULL;
+       struct group grbuf;
+       char *buf;
+-      size_t buflen = sysconf(_SC_GETGR_R_SIZE_MAX);
++      long scbuflen = sysconf(_SC_GETGR_R_SIZE_MAX);
++      size_t buflen = 1024;
+       int err;
+ 
++      if (scbuflen > 0)
++              buflen = (size_t)scbuflen;
++
+       if (domain == NULL)
+               domain = get_default_domain();
+ 
+@@ -192,12 +200,13 @@ static struct passwd *nss_getpwnam(const
+ {
+       struct passwd *pw;
+       struct pwbuf *buf;
+-      size_t buflen = sysconf(_SC_GETPW_R_SIZE_MAX);
++      long scbuflen = sysconf(_SC_GETPW_R_SIZE_MAX);
++      size_t buflen = 1024;
+       char *localname;
+       int err = ENOMEM;
+ 
+-      if (buflen > UINT_MAX)
+-              goto err;
++      if (scbuflen > 0)
++              buflen = (size_t)scbuflen;
+ 
+       buf = malloc(sizeof(*buf) + buflen);
+       if (buf == NULL)
+@@ -301,7 +310,8 @@ static int _nss_name_to_gid(char *name,
+       struct group *gr = NULL;
+       struct group grbuf;
+       char *buf, *domain;
+-      size_t buflen = sysconf(_SC_GETGR_R_SIZE_MAX);
++      long scbuflen = sysconf(_SC_GETGR_R_SIZE_MAX);
++      size_t buflen = 1024;
+       int err = -EINVAL;
+       char *localname = NULL;
+       char *ref_name = NULL;
+@@ -327,8 +337,8 @@ static int _nss_name_to_gid(char *name,
+       }
+ 
+       err = -ENOMEM;
+-      if (buflen > UINT_MAX)
+-              goto out_name;
++      if (scbuflen > 0)
++              buflen = (size_t)scbuflen;
+ 
+       do {
+               buf = malloc(buflen);

diff --git a/net-fs/nfs-utils/files/musl-time64.patch 
b/net-fs/nfs-utils/files/musl-time64.patch
new file mode 100644
index 0000000..62a1d1e
--- /dev/null
+++ b/net-fs/nfs-utils/files/musl-time64.patch
@@ -0,0 +1,51 @@
+diff --git a/utils/nfsdcltrack/nfsdcltrack.c b/utils/nfsdcltrack/nfsdcltrack.c
+index b45a904..6b1049f 100644
+--- a/utils/nfsdcltrack/nfsdcltrack.c
++++ b/utils/nfsdcltrack/nfsdcltrack.c
+@@ -25,9 +25,11 @@
+ 
+ #include <stdio.h>
+ #include <stdlib.h>
+-#include <ctype.h>
+ #include <errno.h>
+ #include <stdbool.h>
++#include <stdint.h>
++#include <inttypes.h>
++#include <ctype.h>
+ #include <getopt.h>
+ #include <string.h>
+ #include <sys/stat.h>
+@@ -525,7 +527,8 @@ cltrack_gracedone(const char *timestr)
+       if (*tail)
+               return -EINVAL;
+ 
+-      xlog(D_GENERAL, "%s: grace done. gracetime=%ld", __func__, gracetime);
++      xlog(D_GENERAL, "%s: grace done. gracetime=%" PRId64, __func__,
++              (int64_t)gracetime);
+ 
+       ret = sqlite_remove_unreclaimed(gracetime);
+ 
+diff --git a/utils/nfsdcltrack/sqlite.c b/utils/nfsdcltrack/sqlite.c
+index 2801201..c4e0cdf 100644
+--- a/utils/nfsdcltrack/sqlite.c
++++ b/utils/nfsdcltrack/sqlite.c
+@@ -42,6 +42,8 @@
+ #include <errno.h>
+ #include <event.h>
+ #include <stdbool.h>
++#include <stdint.h>
++#include <inttypes.h>
+ #include <string.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
+@@ -544,8 +546,8 @@ sqlite_remove_unreclaimed(time_t grace_start)
+       int ret;
+       char *err = NULL;
+ 
+-      ret = snprintf(buf, sizeof(buf), "DELETE FROM clients WHERE time < %ld",
+-                      grace_start);
++      ret = snprintf(buf, sizeof(buf), "DELETE FROM clients WHERE time < %" 
PRId64,
++                      (int64_t)grace_start);
+       if (ret < 0) {
+               return ret;
+       } else if ((size_t)ret >= sizeof(buf)) {

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
deleted file mode 100644
index c9e60af..0000000
--- a/net-fs/nfs-utils/files/nfs-utils-1.1.4-mtab-sym.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-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
deleted file mode 100644
index 7317115..0000000
--- a/net-fs/nfs-utils/files/nfs-utils-1.2.8-cross-build.patch
+++ /dev/null
@@ -1,48 +0,0 @@
-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-2.3.1-svcgssd_undefined_reference.patch 
b/net-fs/nfs-utils/files/nfs-utils-2.3.1-svcgssd_undefined_reference.patch
deleted file mode 100644
index 77c902f..0000000
--- a/net-fs/nfs-utils/files/nfs-utils-2.3.1-svcgssd_undefined_reference.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-From 1451d7585bf1c622658ccc04abac7e79ffe40263 Mon Sep 17 00:00:00 2001
-From: Justin Mitchell <[email protected]>
-Date: Mon, 8 Jan 2018 09:14:11 -0500
-Subject: [PATCH] svcgssd: Update svcgssd so that it builds
-
-Since a15bd948 the --enable-svcgss option no longer builds
-as svcgssd references functions which were changed at that time.
-Fix those, and other function changes since then.
-
-Signed-off-by: Justin Mitchell <[email protected]>
-Signed-off-by: Steve Dickson <[email protected]>
----
- utils/gssd/svcgssd.c | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
-
-diff --git a/utils/gssd/svcgssd.c b/utils/gssd/svcgssd.c
-index 3514ae1..23f0c0b 100644
---- a/utils/gssd/svcgssd.c
-+++ b/utils/gssd/svcgssd.c
-@@ -63,6 +63,8 @@
- #include "err_util.h"
- #include "conffile.h"
- 
-+struct state_paths etab;
-+
- void
- sig_die(int signal)
- {
-@@ -101,7 +103,7 @@ main(int argc, char *argv[])
-       char *principal = NULL;
-       char *s;
- 
--      conf_init(NFS_CONFFILE); 
-+      conf_init_file(NFS_CONFFILE);
- 
-       s = conf_get_str("svcgssd", "principal");
-       if (!s)
--- 
-1.8.3.1
-

diff --git a/net-fs/nfs-utils/files/nfs-utils-2.3.2-junction_libs.patch 
b/net-fs/nfs-utils/files/nfs-utils-2.3.2-junction_libs.patch
deleted file mode 100644
index f13f07a..0000000
--- a/net-fs/nfs-utils/files/nfs-utils-2.3.2-junction_libs.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From 8f3e4f4d6df9f813572051e12e974b35c26a1743 Mon Sep 17 00:00:00 2001
-From: Lars Wendler <[email protected]>
-Date: Mon, 28 May 2018 12:13:10 +0200
-Subject: [PATCH] Fix undefined references and bad include when build with
- junction support
-
----
- support/junction/Makefile.am | 2 +-
- utils/nfsref/Makefile.am     | 6 +++---
- 2 files changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/support/junction/Makefile.am b/support/junction/Makefile.am
-index 97e7426..89cb532 100644
---- a/support/junction/Makefile.am
-+++ b/support/junction/Makefile.am
-@@ -31,4 +31,4 @@ libjunction_la_SOURCES       = display.c export-cache.c 
junction.c \
- 
- MAINTAINERCLEANFILES  = Makefile.in
- 
--AM_CPPFLAGS           = -I. -I../include -I/usr/include/libxml2
-+AM_CPPFLAGS           = -I. -I../include -I/usr/include/libxml2 @TIRPC_CFLAGS@
-diff --git a/utils/nfsref/Makefile.am b/utils/nfsref/Makefile.am
-index 2b2bb53..a652b03 100644
---- a/utils/nfsref/Makefile.am
-+++ b/utils/nfsref/Makefile.am
-@@ -27,13 +27,13 @@ noinst_HEADERS             = nfsref.h
- 
- sbin_PROGRAMS         = nfsref
- nfsref_SOURCES                = add.c lookup.c nfsref.c remove.c
--LDADD                 = $(LIBXML2) $(LIBCAP) \
--                        ../../support/nfs/libnfs.la \
-+LIBS                  += $(LIBXML2) $(LIBCAP)
-+LDADD                 =  ../../support/nfs/libnfs.la \
-                         ../../support/junction/libjunction.la
- 
- man8_MANS             = nfsref.man
- 
- MAINTAINERCLEANFILES  = Makefile.in
- 
--AM_CPPFLAGS           = -I. -I../../support/include
-+AM_CPPFLAGS           = -I. -I../../support/include @TIRPC_CFLAGS@
- ##AM_LDFLAGS          = -Wl,--as-needed
--- 
-2.17.0
-

diff --git 
a/net-fs/nfs-utils/files/nfs-utils-2.4.2-Ensure-consistent-struct-stat.patch 
b/net-fs/nfs-utils/files/nfs-utils-2.4.2-Ensure-consistent-struct-stat.patch
new file mode 100644
index 0000000..8541a98
--- /dev/null
+++ b/net-fs/nfs-utils/files/nfs-utils-2.4.2-Ensure-consistent-struct-stat.patch
@@ -0,0 +1,115 @@
+From 1378280398ef9f5cd45f5542ae2945b9a360b132 Mon Sep 17 00:00:00 2001
+From: Doug Nazar <[email protected]>
+Date: Sun, 17 Nov 2019 14:31:33 -0500
+Subject: [PATCH] Ensure consistent struct stat definition
+
+Although 2fbc62e2a13fc ("Fix include order between config.h and stat.h")
+reorganized those files that were already including config.h, not all
+files were including config.h.
+
+Fixes at least stack smashing crashes in mountd on 32-bit systems.
+
+Signed-off-by: Doug Nazar <[email protected]>
+Signed-off-by: Steve Dickson <[email protected]>
+---
+ support/junction/junction.c | 4 ++++
+ support/misc/file.c         | 4 ++++
+ support/misc/mountpoint.c   | 4 ++++
+ support/nfs/cacheio.c       | 4 ++++
+ utils/mount/fstab.c         | 4 ++++
+ utils/nfsdcld/legacy.c      | 4 ++++
+ 6 files changed, 24 insertions(+)
+
+diff --git a/support/junction/junction.c b/support/junction/junction.c
+index ab6caa6..41cce26 100644
+--- a/support/junction/junction.c
++++ b/support/junction/junction.c
+@@ -27,6 +27,10 @@
+ #include <config.h>
+ #endif
+ 
++#ifdef HAVE_CONFIG_H
++#include <config.h>
++#endif
++
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ 
+diff --git a/support/misc/file.c b/support/misc/file.c
+index e7c3819..06f6bb2 100644
+--- a/support/misc/file.c
++++ b/support/misc/file.c
+@@ -22,6 +22,10 @@
+ #include <config.h>
+ #endif
+ 
++#ifdef HAVE_CONFIG_H
++#include <config.h>
++#endif
++
+ #include <sys/stat.h>
+ 
+ #include <string.h>
+diff --git a/support/misc/mountpoint.c b/support/misc/mountpoint.c
+index c6217f2..14d6731 100644
+--- a/support/misc/mountpoint.c
++++ b/support/misc/mountpoint.c
+@@ -7,6 +7,10 @@
+ #include <config.h>
+ #endif
+ 
++#ifdef HAVE_CONFIG_H
++#include <config.h>
++#endif
++
+ #include <string.h>
+ #include "xcommon.h"
+ #include <sys/stat.h>
+diff --git a/support/nfs/cacheio.c b/support/nfs/cacheio.c
+index 9dc4cf1..7c4cf37 100644
+--- a/support/nfs/cacheio.c
++++ b/support/nfs/cacheio.c
+@@ -19,6 +19,10 @@
+ #include <config.h>
+ #endif
+ 
++#ifdef HAVE_CONFIG_H
++#include <config.h>
++#endif
++
+ #include <nfslib.h>
+ #include <inttypes.h>
+ #include <stdio.h>
+diff --git a/utils/mount/fstab.c b/utils/mount/fstab.c
+index eedbdda..8b0aaf1 100644
+--- a/utils/mount/fstab.c
++++ b/utils/mount/fstab.c
+@@ -11,6 +11,10 @@
+ #include <config.h>
+ #endif
+ 
++#ifdef HAVE_CONFIG_H
++#include <config.h>
++#endif
++
+ #include <errno.h>
+ #include <stdio.h>
+ #include <fcntl.h>
+diff --git a/utils/nfsdcld/legacy.c b/utils/nfsdcld/legacy.c
+index 07f477a..3c6bea6 100644
+--- a/utils/nfsdcld/legacy.c
++++ b/utils/nfsdcld/legacy.c
+@@ -19,6 +19,10 @@
+ #include <config.h>
+ #endif
+ 
++#ifdef HAVE_CONFIG_H
++#include <config.h>
++#endif
++
+ #include <stdio.h>
+ #include <dirent.h>
+ #include <string.h>
+-- 
+1.8.3.1
+

diff --git a/net-fs/nfs-utils/files/nfs-utils-2.3.2-no-werror.patch 
b/net-fs/nfs-utils/files/nfs-utils-2.5.2-no-werror.patch
similarity index 63%
rename from net-fs/nfs-utils/files/nfs-utils-2.3.2-no-werror.patch
rename to net-fs/nfs-utils/files/nfs-utils-2.5.2-no-werror.patch
index d06fc4c..a7226db 100644
--- a/net-fs/nfs-utils/files/nfs-utils-2.3.2-no-werror.patch
+++ b/net-fs/nfs-utils/files/nfs-utils-2.5.2-no-werror.patch
@@ -1,17 +1,27 @@
+From 6ab8c7c186bd4a547a0ca435ecabe10ee50039c5 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <[email protected]>
+Date: Thu, 22 Oct 2020 19:44:34 +0200
+Subject: [PATCH] Don't build with -Werror flags
+
 https://bugs.gentoo.org/656984
 
-Don't build with -Werror flags.
+Signed-off-by: Lars Wendler <[email protected]>
+---
+ configure.ac | 34 +---------------------------------
+ 1 file changed, 1 insertion(+), 33 deletions(-)
 
+diff --git a/configure.ac b/configure.ac
+index 50847d8a..6bc18e93 100644
 --- a/configure.ac
 +++ b/configure.ac
-@@ -544,45 +544,11 @@
+@@ -631,47 +631,15 @@ AC_SUBST(CPPFLAGS_FOR_BUILD)
  AC_SUBST(LDFLAGS_FOR_BUILD)
  
  my_am_cflags="\
 - -pipe \
   -Wall \
   -Wextra \
-- -Werror=strict-prototypes \
+  $rpcgen_cflags \
 - -Werror=missing-prototypes \
 - -Werror=missing-declarations \
 - -Werror=format=2 \
@@ -28,10 +38,10 @@ Don't build with -Werror flags.
 - -Werror=unused-result \
   -fno-strict-aliasing \
  "
--
+ 
 -AC_DEFUN([CHECK_CCSUPPORT], [
 -  my_save_cflags="$CFLAGS"
--  CFLAGS=$1
+-  CFLAGS="-Werror $1"
 -  AC_MSG_CHECKING([whether CC supports $1])
 -  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
 -    [AC_MSG_RESULT([yes])]
@@ -45,9 +55,14 @@ Don't build with -Werror flags.
 -CHECK_CCSUPPORT([-Werror=int-conversion], [flg2])
 -CHECK_CCSUPPORT([-Werror=incompatible-pointer-types], [flg3])
 -CHECK_CCSUPPORT([-Werror=misleading-indentation], [flg4])
--
--AC_SUBST([AM_CFLAGS], ["$my_am_cflags $flg1 $flg2 $flg3 $flg4"])
+-CHECK_CCSUPPORT([-Wno-cast-function-type], [flg5])
+ AX_GCC_FUNC_ATTRIBUTE([format])
+ 
+-AC_SUBST([AM_CFLAGS], ["$my_am_cflags $flg1 $flg2 $flg3 $flg4 $flg5"])
 +AC_SUBST([AM_CFLAGS], ["$my_am_cflags"])
  
  # Make sure that $ACLOCAL_FLAGS are used during a rebuild
  AC_SUBST([ACLOCAL_AMFLAGS], ["-I $ac_macro_dir \$(ACLOCAL_FLAGS)"])
+-- 
+2.29.0
+

diff --git a/net-fs/nfs-utils/files/nfs-utils-musl.patch 
b/net-fs/nfs-utils/files/nfs-utils-musl.patch
deleted file mode 100644
index e880072..0000000
--- a/net-fs/nfs-utils/files/nfs-utils-musl.patch
+++ /dev/null
@@ -1,147 +0,0 @@
---- nfs-utils-2.3.1/configure.ac.orig  2018-05-21 11:05:01.939912918 -0700
-+++ nfs-utils-2.3.1/configure.ac       2018-05-21 11:05:10.531968707 -0700
-@@ -401,7 +401,7 @@
- fi
- 
- dnl libdnsidmap specific checks
--AC_CHECK_LIB([resolv], [__res_querydomain], , AC_MSG_ERROR(res_querydomain 
needed))
-+AC_CHECK_LIB([resolv], [res_querydomain], , AC_MSG_ERROR(res_querydomain 
needed))
- 
- AC_ARG_ENABLE([ldap],
-       [AS_HELP_STRING([--disable-ldap],[Disable support for LDAP 
@<:default=detect@:>@])])
---- nfs-utils-2.3.1/support/misc/file.c.orig   2018-05-21 18:15:37.572007979 
+0000
-+++ nfs-utils-2.3.1/support/misc/file.c        2018-05-21 18:15:43.668047008 
+0000
-@@ -27,6 +27,7 @@
- #include <dirent.h>
- #include <stdlib.h>
- #include <stdbool.h>
-+#include <limits.h> /* PATH_MAX */
- 
- #include "xlog.h"
- #include "misc.h"
-diff -Naur nfs-utils-2.3.3-orig/support/export/client.c 
nfs-utils-2.3.3/support/export/client.c
---- nfs-utils-2.3.3-orig/support/export/client.c       2018-09-06 
13:09:08.000000000 -0500
-+++ nfs-utils-2.3.3/support/export/client.c    2019-04-21 02:48:45.676838188 
-0500
-@@ -309,7 +309,8 @@
-               init_addrlist(clp, ai);
- 
- out:
--      freeaddrinfo(ai);
-+      if (ai != NULL)
-+              freeaddrinfo(ai);
-       return clp;
- }
- 
-diff -Naur nfs-utils-2.3.3-orig/tests/nsm_client/nsm_client.c 
nfs-utils-2.3.3/tests/nsm_client/nsm_client.c
---- nfs-utils-2.3.3-orig/tests/nsm_client/nsm_client.c 2018-09-06 
13:09:08.000000000 -0500
-+++ nfs-utils-2.3.3/tests/nsm_client/nsm_client.c      2019-04-21 
02:35:53.139552780 -0500
-@@ -243,7 +243,8 @@
-               printf("RPC client creation failed\n");
-       }
- out:
--      freeaddrinfo(ai);
-+      if (ai != NULL)
-+              freeaddrinfo(ai);
-       return client;
- }
- 
-diff -Naur nfs-utils-2.3.3-orig/utils/exportfs/exportfs.c 
nfs-utils-2.3.3/utils/exportfs/exportfs.c
---- nfs-utils-2.3.3-orig/utils/exportfs/exportfs.c     2018-09-06 
13:09:08.000000000 -0500
-+++ nfs-utils-2.3.3/utils/exportfs/exportfs.c  2019-04-21 02:40:07.432327005 
-0500
-@@ -282,7 +282,8 @@
-       validate_export(exp);
- 
- out:
--      freeaddrinfo(ai);
-+      if (ai != NULL)
-+              freeaddrinfo(ai);
- }
- 
- static int exportfs_generic(char *arg, char *options, int verbose)
-@@ -395,7 +396,8 @@
-       if (!success)
-               xlog(L_ERROR, "Could not find '%s:%s' to unexport.", hname, 
path);
- 
--      freeaddrinfo(ai);
-+      if (ai != NULL)
-+              freeaddrinfo(ai);
- }
- 
- static int unexportfs_generic(char *arg, int verbose)
-@@ -639,8 +641,10 @@
-                       }
- 
- out:
--      freeaddrinfo(results1);
--      freeaddrinfo(results2);
-+      if (results1 != NULL)
-+              freeaddrinfo(results1);
-+      if (results2 != NULL)
-+              freeaddrinfo(results2);
-       return result;
- }
- 
-diff -Naur nfs-utils-2.3.3-orig/utils/mount/stropts.c 
nfs-utils-2.3.3/utils/mount/stropts.c
---- nfs-utils-2.3.3-orig/utils/mount/stropts.c 2018-09-06 13:09:08.000000000 
-0500
-+++ nfs-utils-2.3.3/utils/mount/stropts.c      2019-04-21 02:43:18.451874403 
-0500
-@@ -1263,7 +1263,8 @@
-       } else
-               nfs_error(_("%s: internal option parsing error"), progname);
- 
--      freeaddrinfo(mi.address);
-+      if (mi.address != NULL)
-+              freeaddrinfo(mi.address);
-       free(mi.hostname);
-       return retval;
- }
-diff -Naur nfs-utils-2.3.3-orig/utils/mountd/cache.c 
nfs-utils-2.3.3/utils/mountd/cache.c
---- nfs-utils-2.3.3-orig/utils/mountd/cache.c  2019-04-21 02:33:43.603417171 
-0500
-+++ nfs-utils-2.3.3/utils/mountd/cache.c       2019-04-21 02:45:11.289792765 
-0500
-@@ -834,7 +834,8 @@
- out:
-       if (found_path)
-               free(found_path);
--      freeaddrinfo(ai);
-+      if (ai != NULL)
-+              freeaddrinfo(ai);
-       free(dom);
-       xlog(D_CALL, "nfsd_fh: found %p path %s", found, found ? found->e_path 
: NULL);
- }
-@@ -1355,7 +1356,7 @@
-       xlog(D_CALL, "nfsd_export: found %p path %s", found, path ? path : 
NULL);
-       if (dom) free(dom);
-       if (path) free(path);
--      freeaddrinfo(ai);
-+      if (ai) freeaddrinfo(ai);
- }
- 
- 
-diff -Naur nfs-utils-2.3.3-orig/utils/mountd/mountd.c 
nfs-utils-2.3.3/utils/mountd/mountd.c
---- nfs-utils-2.3.3-orig/utils/mountd/mountd.c 2018-09-06 13:09:08.000000000 
-0500
-+++ nfs-utils-2.3.3/utils/mountd/mountd.c      2019-04-21 02:45:41.796526387 
-0500
-@@ -581,7 +581,8 @@
-                               freeaddrinfo(ai);
-                               continue;
-                       }
--                      freeaddrinfo(ai);
-+                      if (ai != NULL)
-+                              freeaddrinfo(ai);
-               }
-               cp = &(c->gr_next);
-       }
-diff -Naur nfs-utils-2.3.3-orig/utils/statd/hostname.c 
nfs-utils-2.3.3/utils/statd/hostname.c
---- nfs-utils-2.3.3-orig/utils/statd/hostname.c        2018-09-06 
13:09:08.000000000 -0500
-+++ nfs-utils-2.3.3/utils/statd/hostname.c     2019-04-21 02:41:39.712446505 
-0500
-@@ -308,8 +308,10 @@
-                       }
- 
- out:
--      freeaddrinfo(results2);
--      freeaddrinfo(results1);
-+      if (results2 != NULL)
-+              freeaddrinfo(results2);
-+      if (results1 != NULL)
-+              freeaddrinfo(results1);
- 
-       xlog(D_CALL, "%s: hostnames %s and %s %s", __func__,
-                       hostname1, hostname2,

diff --git a/net-fs/nfs-utils/files/nfs-utils.conf 
b/net-fs/nfs-utils/files/nfs-utils.conf
deleted file mode 100644
index b9b586c..0000000
--- a/net-fs/nfs-utils/files/nfs-utils.conf
+++ /dev/null
@@ -1,3 +0,0 @@
-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.initd b/net-fs/nfs-utils/files/nfs.initd
index 4b572fc..9b4f8a4 100644
--- a/net-fs/nfs-utils/files/nfs.initd
+++ b/net-fs/nfs-utils/files/nfs.initd
@@ -1,13 +1,9 @@
 #!/sbin/openrc-run
-# Copyright 1999-2014 Gentoo Foundation
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 extra_started_commands="reload"
 
-# This variable is used for controlling whether or not to run exportfs -ua;
-# see stop() for more information
-restarting=no
-
 # The binary locations
 exportfs=/usr/sbin/exportfs
   mountd=/usr/sbin/rpc.mountd
@@ -88,7 +84,7 @@ start() {
        # Exportfs likes to hang if networking isn't working.
        # If that's the case, then try to kill it so the
        # bootup process can continue.
-       if grep -qs '^[[:space:]]*/' /etc/exports /etc/exports.d/*.exports ; 
then
+       if grep -qs '^[[:space:]]*"\?/' /etc/exports /etc/exports.d/*.exports ; 
then
                ebegin "Exporting NFS directories"
                ${exportfs} -r &
                waitfor_exportfs $!
@@ -131,7 +127,7 @@ stop() {
        # then "exportfs -r" will reread the xtab, and all the current
        # clients will be able to resume NFS activity, *without* needing
        # to umount/(re)mount the filesystem.
-       if [ "${restarting}" = no -o "${RC_CMD}" = "restart" ] ; then
+       if [ "${RC_CMD}" != "restart" ] ; then
                ebegin "Unexporting NFS directories"
                # Exportfs likes to hang if networking isn't working.
                # If that's the case, then try to kill it so the
@@ -155,8 +151,6 @@ reload() {
 }
 
 restart() {
-       # See long comment in stop() regarding "restarting" and exportfs -ua
-       restarting=yes
        svc_stop
        svc_start
 }

diff --git a/net-fs/nfs-utils/files/nfsmount.confd 
b/net-fs/nfs-utils/files/nfsmount.confd
deleted file mode 100644
index 4183536..0000000
--- a/net-fs/nfs-utils/files/nfsmount.confd
+++ /dev/null
@@ -1,7 +0,0 @@
-# You will need to set the dependencies in the nfsmount script to match
-# the network configuration tools you are using. This should be done in
-# this file by following the examples below, and not by changing the
-# service script itself.  See /etc/conf.d/netmount for more examples.
-#
-# This is a safe default.
-rc_after="net"

diff --git a/net-fs/nfs-utils/files/nfsmount.initd 
b/net-fs/nfs-utils/files/nfsmount.initd
deleted file mode 100644
index 12c7d78..0000000
--- a/net-fs/nfs-utils/files/nfsmount.initd
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/sbin/openrc-run
-# Copyright 1999-2013 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-[ -e /etc/conf.d/nfs ] && . /etc/conf.d/nfs
-
-depend() {
-       local myneed=""
-       if [ -e /etc/fstab ] ; then
-               myneed="${myneed} $(
-                       awk '!/^[[:space:]]*#/ && ($3 == "nfs" || $3 == "nfs4") 
{
-                                       if ($3 == "nfs4")
-                                               idmapd = "rpc.idmapd"
-                                       if ($4 ~ /sec=(krb|spkm)/)
-                                               gssd = "rpc.gssd"
-                               }
-                               END { print idmapd " " gssd }
-                               ' /etc/fstab
-                       )"
-       fi
-       config /etc/fstab
-       need portmap rpc.statd ${myneed}
-       use ypbind dns rpc.idmapd rpc.gssd
-}
-
-start() {
-       if [ -x /usr/sbin/sm-notify ] ; then
-               ebegin "Starting NFS sm-notify"
-               /usr/sbin/sm-notify ${OPTS_SMNOTIFY}
-               eend $?
-       fi
-
-       # Make sure nfs support is loaded in the kernel #64709
-       if [ -e /proc/modules ] && ! grep -qs 'nfs$' /proc/filesystems ; then
-               modprobe -q nfs
-       fi
-
-       ebegin "Mounting NFS filesystems"
-       mount -a -t nfs,nfs4
-       eend $?
-}
-
-stop() {
-       ebegin "Unmounting NFS filesystems"
-       umount -a -t nfs,nfs4
-       eend $?
-}

diff --git a/net-fs/nfs-utils/metadata.xml b/net-fs/nfs-utils/metadata.xml
index 45351e4..159356c 100644
--- a/net-fs/nfs-utils/metadata.xml
+++ b/net-fs/nfs-utils/metadata.xml
@@ -5,7 +5,6 @@
     <email>[email protected]</email>
     <name>Gentoo Base System</name>
   </maintainer>
-  <longdescription>NFS client and server daemons</longdescription>
   <use>
     <flag name="junction">Enable NFS junction support in nfsref</flag>
     <flag name="ldap">Add ldap support</flag>

diff --git a/net-fs/nfs-utils/nfs-utils-1.3.4-r1.ebuild 
b/net-fs/nfs-utils/nfs-utils-1.3.4-r1.ebuild
deleted file mode 100644
index 7f48d44..0000000
--- a/net-fs/nfs-utils/nfs-utils-1.3.4-r1.ebuild
+++ /dev/null
@@ -1,182 +0,0 @@
-# Copyright 1999-2018 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="5"
-
-inherit eutils flag-o-matic multilib autotools systemd
-
-DESCRIPTION="NFS client and server daemons"
-HOMEPAGE="http://linux-nfs.org/";
-SRC_URI="mirror://sourceforge/nfs/${P}.tar.bz2"
-
-LICENSE="GPL-2"
-SLOT="0"
-KEYWORDS="amd64 arm arm64 ~mips ppc ppc64 x86"
-IUSE="caps ipv6 kerberos +libmount nfsdcld +nfsidmap +nfsv4 nfsv41 selinux 
tcpd +uuid"
-REQUIRED_USE="kerberos? ( nfsv4 )"
-RESTRICT="test" #315573
-
-# kth-krb doesn't provide the right include
-# files, and nfs-utils doesn't build against heimdal either,
-# so don't depend on virtual/krb.
-# (04 Feb 2005 agriffis)
-DEPEND_COMMON="tcpd? ( sys-apps/tcp-wrappers )
-       caps? ( sys-libs/libcap )
-       sys-libs/e2fsprogs-libs
-       >=net-nds/rpcbind-0.2.4
-       net-libs/libtirpc:=
-       libmount? ( sys-apps/util-linux )
-       nfsdcld? ( >=dev-db/sqlite-3.3 )
-       nfsv4? (
-               dev-libs/libevent:=
-               >=net-libs/libnfsidmap-0.21-r1
-               kerberos? (
-                       >=net-libs/libtirpc-0.2.4-r1[kerberos]
-                       app-crypt/mit-krb5
-               )
-               nfsidmap? (
-                       >=net-libs/libnfsidmap-0.24
-                       >=sys-apps/keyutils-1.5.9
-               )
-       )
-       nfsv41? (
-               sys-fs/lvm2
-       )
-       uuid? ( sys-apps/util-linux )"
-RDEPEND="${DEPEND_COMMON}
-       !net-nds/portmap
-       !<sys-apps/openrc-0.13.9
-       selinux? (
-               sec-policy/selinux-rpc
-               sec-policy/selinux-rpcbind
-       )
-"
-DEPEND="${DEPEND_COMMON}
-       virtual/pkgconfig"
-
-PATCHES=(
-       "${FILESDIR}"/${PN}-musl.patch
-)
-
-src_prepare() {
-       epatch "${FILESDIR}"/${PN}-1.1.4-mtab-sym.patch
-       epatch "${FILESDIR}"/${PN}-1.2.8-cross-build.patch
-
-       sed \
-               -e "/^sbindir/s:= := \"${EPREFIX}\":g" \
-               -i utils/*/Makefile.am || die
-
-       epatch_user
-       eautoreconf
-}
-
-src_configure() {
-       export libsqlite3_cv_is_recent=yes # Our DEPEND forces this.
-       export ac_cv_header_keyutils_h=$(usex nfsidmap)
-       econf \
-               --with-statedir="${EPREFIX}"/var/lib/nfs \
-               --enable-tirpc \
-               --with-tirpcinclude="${EPREFIX}"/usr/include/tirpc/ \
-               $(use_enable libmount libmount-mount) \
-               $(use_with tcpd tcp-wrappers) \
-               $(use_enable nfsdcld nfsdcltrack) \
-               $(use_enable nfsv4) \
-               $(use_enable nfsv41) \
-               $(use_enable ipv6) \
-               $(use_enable caps) \
-               $(use_enable uuid) \
-               $(use_enable kerberos gss) \
-               $(use_enable kerberos svcgss) \
-               --without-gssglue
-}
-
-src_compile(){
-       # remove compiled files bundled in the tarball
-       emake clean
-       default
-}
-
-src_install() {
-       default
-       rm linux-nfs/Makefile* || die
-       dodoc -r linux-nfs README
-
-       # Don't overwrite existing xtab/etab, install the original
-       # versions somewhere safe...  more info in pkg_postinst
-       keepdir /var/lib/nfs/{,sm,sm.bak}
-       mv "${ED}"/var/lib "${ED}"/usr/$(get_libdir) || die
-
-       # Install some client-side binaries in /sbin
-       dodir /sbin
-       mv "${ED}"/usr/sbin/rpc.statd "${ED}"/sbin/ || die
-
-       if use nfsv4 && use nfsidmap ; then
-               # Install a config file for idmappers in newer kernels. #415625
-               insinto /etc/request-key.d
-               echo 'create id_resolver * * /usr/sbin/nfsidmap -t 600 %k %d' > 
id_resolver.conf
-               doins id_resolver.conf
-       fi
-
-       insinto /etc
-       doins "${FILESDIR}"/exports
-       keepdir /etc/exports.d
-
-       local f list=() opt_need=""
-       if use nfsv4 ; then
-               opt_need="rpc.idmapd"
-               list+=( rpc.idmapd rpc.pipefs )
-               use kerberos && list+=( rpc.gssd rpc.svcgssd )
-       fi
-       for f in nfs nfsclient rpc.statd "${list[@]}" ; do
-               newinitd "${FILESDIR}"/${f}.initd ${f}
-       done
-       newinitd "${FILESDIR}"/nfsmount.initd-1.3.1 nfsmount # Nuke after 
2015/08/01
-       for f in nfs nfsclient ; do
-               newconfd "${FILESDIR}"/${f}.confd ${f}
-       done
-       sed -i \
-               -e "/^NFS_NEEDED_SERVICES=/s:=.*:=\"${opt_need}\":" \
-               "${ED}"/etc/conf.d/nfs || die #234132
-
-       systemd_dounit systemd/*.{mount,service,target}
-       if ! use nfsv4 || ! use kerberos ; then
-               rm "${D}$(systemd_get_unitdir)"/rpc-{gssd,svcgssd}.service || 
die
-       fi
-       if ! use nfsv41 ; then
-               rm "${D}$(systemd_get_unitdir)"/nfs-blkmap.* || die
-       fi
-       rm "${D}$(systemd_get_unitdir)"/nfs-config.service || die
-       sed -i -r \
-               -e "/^EnvironmentFile=/s:=.*:=${EPREFIX}/etc/conf.d/nfs:" \
-               -e '/^(After|Wants)=nfs-config.service$/d' \
-               -e 's:/usr/sbin/rpc.statd:/sbin/rpc.statd:' \
-               "${D}$(systemd_get_unitdir)"/* || die
-
-       keepdir /var/lib/nfs #368505
-       keepdir /var/lib/nfs/v4recovery #603628
-}
-
-pkg_postinst() {
-       # Install default xtab and friends if there's none existing.  In
-       # src_install we put them in /usr/lib/nfs for safe-keeping, but
-       # the daemons actually use the files in /var/lib/nfs.  #30486
-       local f
-       for f in "${EROOT}"/usr/$(get_libdir)/nfs/*; do
-               [[ -e ${EROOT}/var/lib/nfs/${f##*/} ]] && continue
-               einfo "Copying default ${f##*/} from 
${EPREFIX}/usr/$(get_libdir)/nfs to ${EPREFIX}/var/lib/nfs"
-               cp -pPR "${f}" "${EROOT}"/var/lib/nfs/
-       done
-
-       if systemd_is_booted; then
-               if [[ ${REPLACING_VERSIONS} < 1.3.0 ]]; then
-                       ewarn "We have switched to upstream systemd unit files. 
Since"
-                       ewarn "they got renamed, you should probably enable the 
new ones."
-                       ewarn "You can run 'equery files nfs-utils | grep 
systemd'"
-                       ewarn "to know what services you need to enable now."
-               fi
-       else
-               ewarn "If you use OpenRC, the nfsmount service has been 
replaced with nfsclient."
-               ewarn "If you were using nfsmount, please add nfsclient and 
netmount to the"
-               ewarn "same runlevel as nfsmount."
-       fi
-}

diff --git a/net-fs/nfs-utils/nfs-utils-2.3.1-r3.ebuild 
b/net-fs/nfs-utils/nfs-utils-2.3.1-r3.ebuild
deleted file mode 100644
index 432515c..0000000
--- a/net-fs/nfs-utils/nfs-utils-2.3.1-r3.ebuild
+++ /dev/null
@@ -1,187 +0,0 @@
-# Copyright 1999-2018 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-inherit autotools flag-o-matic multilib systemd
-
-DESCRIPTION="NFS client and server daemons"
-HOMEPAGE="http://linux-nfs.org/";
-
-if [[ "${PV}" = *_rc* ]] ; then
-       inherit versionator
-       MY_PV="$(replace_all_version_separators -)"
-       
SRC_URI="http://git.linux-nfs.org/?p=steved/nfs-utils.git;a=snapshot;h=refs/tags/${PN}-${MY_PV};sf=tgz
 -> ${P}.tar.gz"
-       S="${WORKDIR}/${PN}-${PN}-${MY_PV}"
-else
-       SRC_URI="mirror://sourceforge/nfs/${P}.tar.bz2"
-       KEYWORDS="amd64 arm arm64 ~mips ppc ppc64 x86"
-fi
-
-LICENSE="GPL-2"
-SLOT="0"
-IUSE="caps ipv6 kerberos ldap +libmount nfsdcld +nfsidmap +nfsv4 nfsv41 
selinux tcpd +uuid"
-REQUIRED_USE="kerberos? ( nfsv4 )"
-RESTRICT="test" #315573
-
-# kth-krb doesn't provide the right include
-# files, and nfs-utils doesn't build against heimdal either,
-# so don't depend on virtual/krb.
-# (04 Feb 2005 agriffis)
-DEPEND_COMMON="
-       net-libs/libtirpc:=
-       >=net-nds/rpcbind-0.2.4
-       sys-libs/e2fsprogs-libs
-       caps? ( sys-libs/libcap )
-       ldap? ( net-nds/openldap )
-       libmount? ( sys-apps/util-linux )
-       nfsdcld? ( >=dev-db/sqlite-3.3 )
-       nfsv4? (
-               dev-libs/libevent:=
-               >=sys-apps/keyutils-1.5.9
-               kerberos? (
-                       >=net-libs/libtirpc-0.2.4-r1[kerberos]
-                       app-crypt/mit-krb5
-               )
-       )
-       nfsv41? (
-               sys-fs/lvm2
-       )
-       tcpd? ( sys-apps/tcp-wrappers )
-       uuid? ( sys-apps/util-linux )"
-RDEPEND="${DEPEND_COMMON}
-       !net-libs/libnfsidmap
-       !net-nds/portmap
-       !<sys-apps/openrc-0.13.9
-       selinux? (
-               sec-policy/selinux-rpc
-               sec-policy/selinux-rpcbind
-       )
-"
-DEPEND="${DEPEND_COMMON}
-       virtual/pkgconfig"
-
-PATCHES=(
-       "${FILESDIR}"/${PN}-1.1.4-mtab-sym.patch
-       "${FILESDIR}"/${PN}-1.2.8-cross-build.patch
-       "${FILESDIR}"/${P}-svcgssd_undefined_reference.patch #641912
-       "${FILESDIR}"/${PN}-musl.patch
-)
-
-src_prepare() {
-       default
-
-       sed \
-               -e "/^sbindir/s:= := \"${EPREFIX}\":g" \
-               -i utils/*/Makefile.am || die
-
-       eautoreconf
-}
-
-src_configure() {
-       export libsqlite3_cv_is_recent=yes # Our DEPEND forces this.
-       export ac_cv_header_keyutils_h=$(usex nfsidmap)
-       local myeconfargs=(
-               --with-statedir="${EPREFIX%/}"/var/lib/nfs
-               --enable-tirpc
-               --with-tirpcinclude="${EPREFIX%/}"/usr/include/tirpc/
-               --with-pluginpath="${EPREFIX%/}"/usr/$(get_libdir)/libnfsidmap
-               --with-systemd="$(systemd_get_systemunitdir)"
-               --without-gssglue
-               $(use_enable caps)
-               $(use_enable ipv6)
-               $(use_enable kerberos gss)
-               $(use_enable kerberos svcgss)
-               $(use_enable ldap)
-               $(use_enable libmount libmount-mount)
-               $(use_enable nfsdcld nfsdcltrack)
-               $(use_enable nfsv4)
-               $(use_enable nfsv41)
-               $(use_enable uuid)
-               $(use_with tcpd tcp-wrappers)
-       )
-       econf "${myeconfargs[@]}"
-}
-
-src_compile(){
-       # remove compiled files bundled in the tarball
-       emake clean
-       default
-}
-
-src_install() {
-       default
-       rm linux-nfs/Makefile* || die
-       dodoc -r linux-nfs README
-
-       # Don't overwrite existing xtab/etab, install the original
-       # versions somewhere safe...  more info in pkg_postinst
-       keepdir /var/lib/nfs/{,sm,sm.bak}
-       mv "${ED%/}"/var/lib/nfs "${ED%/}"/usr/$(get_libdir)/ || die
-
-       # Install some client-side binaries in /sbin
-       dodir /sbin
-       mv "${ED%/}"/usr/sbin/rpc.statd "${ED%/}"/sbin/ || die
-
-       if use nfsv4 && use nfsidmap ; then
-               # Install a config file for idmappers in newer kernels. #415625
-               insinto /etc/request-key.d
-               echo 'create id_resolver * * /usr/sbin/nfsidmap -t 600 %k %d' > 
id_resolver.conf
-               doins id_resolver.conf
-       fi
-
-       insinto /etc
-       doins "${FILESDIR}"/exports
-       keepdir /etc/exports.d
-
-       local f list=() opt_need=""
-       if use nfsv4 ; then
-               opt_need="rpc.idmapd"
-               list+=( rpc.idmapd rpc.pipefs )
-               use kerberos && list+=( rpc.gssd rpc.svcgssd )
-       fi
-       for f in nfs nfsclient rpc.statd "${list[@]}" ; do
-               newinitd "${FILESDIR}"/${f}.initd ${f}
-       done
-       newinitd "${FILESDIR}"/nfsmount.initd-1.3.1 nfsmount # Nuke after 
2015/08/01
-       for f in nfs nfsclient ; do
-               newconfd "${FILESDIR}"/${f}.confd ${f}
-       done
-       sed -i \
-               -e "/^NFS_NEEDED_SERVICES=/s:=.*:=\"${opt_need}\":" \
-               "${ED%/}"/etc/conf.d/nfs || die #234132
-
-       local systemd_systemunitdir="$(systemd_get_systemunitdir)"
-       sed -i \
-               -e 's:/usr/sbin/rpc.statd:/sbin/rpc.statd:' \
-               "${ED%/}${systemd_systemunitdir}"/* || die
-
-       keepdir /var/lib/nfs #368505
-       keepdir /var/lib/nfs/v4recovery #603628
-
-}
-
-pkg_postinst() {
-       # Install default xtab and friends if there's none existing.  In
-       # src_install we put them in /usr/lib/nfs for safe-keeping, but
-       # the daemons actually use the files in /var/lib/nfs.  #30486
-       local f
-       for f in "${EROOT%/}"/usr/$(get_libdir)/nfs/*; do
-               [[ -e ${EROOT%/}/var/lib/nfs/${f##*/} ]] && continue
-               einfo "Copying default ${f##*/} from 
${EPREFIX}/usr/$(get_libdir)/nfs to ${EPREFIX}/var/lib/nfs"
-               cp -pPR "${f}" "${EROOT%/}"/var/lib/nfs/
-       done
-
-       if systemd_is_booted; then
-               if [[ ${REPLACING_VERSIONS} < 1.3.0 ]]; then
-                       ewarn "We have switched to upstream systemd unit files. 
Since"
-                       ewarn "they got renamed, you should probably enable the 
new ones."
-                       ewarn "You can run 'equery files nfs-utils | grep 
systemd'"
-                       ewarn "to know what services you need to enable now."
-               fi
-       else
-               ewarn "If you use OpenRC, the nfsmount service has been 
replaced with nfsclient."
-               ewarn "If you were using nfsmount, please add nfsclient and 
netmount to the"
-               ewarn "same runlevel as nfsmount."
-       fi
-}

diff --git a/net-fs/nfs-utils/nfs-utils-2.3.3.ebuild 
b/net-fs/nfs-utils/nfs-utils-2.5.3-r1.ebuild
similarity index 65%
rename from net-fs/nfs-utils/nfs-utils-2.3.3.ebuild
rename to net-fs/nfs-utils/nfs-utils-2.5.3-r1.ebuild
index 82f23c9..60ec533 100644
--- a/net-fs/nfs-utils/nfs-utils-2.3.3.ebuild
+++ b/net-fs/nfs-utils/nfs-utils-2.5.3-r1.ebuild
@@ -1,21 +1,20 @@
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=6
+EAPI=7
 
-inherit autotools flag-o-matic multilib systemd
+inherit autotools linux-info systemd
 
 DESCRIPTION="NFS client and server daemons"
 HOMEPAGE="http://linux-nfs.org/";
 
 if [[ "${PV}" = *_rc* ]] ; then
-       inherit versionator
-       MY_PV="$(replace_all_version_separators -)"
+       MY_PV="$(ver_rs 1- -)"
        
SRC_URI="http://git.linux-nfs.org/?p=steved/nfs-utils.git;a=snapshot;h=refs/tags/${PN}-${MY_PV};sf=tgz
 -> ${P}.tar.gz"
        S="${WORKDIR}/${PN}-${PN}-${MY_PV}"
 else
        SRC_URI="mirror://sourceforge/nfs/${P}.tar.bz2"
-       KEYWORDS="amd64 arm arm64 ~mips ppc ppc64 x86"
+       KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~mips ppc ppc64 ~riscv 
~s390 sparc x86"
 fi
 
 LICENSE="GPL-2"
@@ -28,17 +27,18 @@ RESTRICT="test" #315573
 # files, and nfs-utils doesn't build against heimdal either,
 # so don't depend on virtual/krb.
 # (04 Feb 2005 agriffis)
-DEPEND_COMMON="
+DEPEND="
+       >=dev-db/sqlite-3.3
+       dev-libs/libxml2
        net-libs/libtirpc:=
        >=net-nds/rpcbind-0.2.4
        sys-libs/e2fsprogs-libs
        caps? ( sys-libs/libcap )
        ldap? ( net-nds/openldap )
        libmount? ( sys-apps/util-linux )
-       nfsdcld? ( >=dev-db/sqlite-3.3 )
        nfsv4? (
                dev-libs/libevent:=
-               >=sys-apps/keyutils-1.5.9
+               >=sys-apps/keyutils-1.5.9:=
                kerberos? (
                        >=net-libs/libtirpc-0.2.4-r1[kerberos]
                        app-crypt/mit-krb5
@@ -49,7 +49,7 @@ DEPEND_COMMON="
        )
        tcpd? ( sys-apps/tcp-wrappers )
        uuid? ( sys-apps/util-linux )"
-RDEPEND="${DEPEND_COMMON}
+RDEPEND="${DEPEND}
        !net-libs/libnfsidmap
        !net-nds/portmap
        !<sys-apps/openrc-0.13.9
@@ -58,22 +58,35 @@ RDEPEND="${DEPEND_COMMON}
                sec-policy/selinux-rpcbind
        )
 "
-DEPEND="${DEPEND_COMMON}
-       dev-libs/libxml2
+BDEPEND="
        net-libs/rpcsvc-proto
-       virtual/pkgconfig"
+       virtual/pkgconfig
+"
 
 PATCHES=(
-       "${FILESDIR}"/${PN}-1.1.4-mtab-sym.patch
-       "${FILESDIR}"/${PN}-1.2.8-cross-build.patch
-       "${FILESDIR}"/${PN}-2.3.2-junction_libs.patch
-       "${FILESDIR}"/${PN}-2.3.2-no-werror.patch
-       "${FILESDIR}"/${PN}-musl.patch
+       "${FILESDIR}"/${PN}-2.5.2-no-werror.patch
+       "${FILESDIR}"/${PN}-2.4.2-Ensure-consistent-struct-stat.patch
 )
 
+pkg_setup() {
+       linux-info_pkg_setup
+       if use nfsv4 && ! use nfsdcld && linux_config_exists && ! 
linux_chkconfig_present CRYPTO_MD5 ; then
+               ewarn "Your NFS server will be unable to track clients across 
server restarts!"
+               ewarn "Please enable the \"${HILITE}nfsdcld${NORMAL}\" USE flag 
to install the nfsdcltrack usermode"
+               ewarn "helper upcall program, or enable 
${HILITE}CONFIG_CRYPTO_MD5${NORMAL} in your kernel to"
+               ewarn "support the legacy, in-kernel client tracker."
+       fi
+}
+
 src_prepare() {
        default
 
+       if use elibc_musl; then
+               eapply "${FILESDIR}/musl-time64.patch"
+               eapply "${FILESDIR}/musl-getservbyport.patch"
+               eapply "${FILESDIR}/musl-svcgssd-sysconf.patch"
+       fi
+
        sed \
                -e "/^sbindir/s:= := \"${EPREFIX}\":g" \
                -i utils/*/Makefile.am || die
@@ -85,10 +98,11 @@ src_configure() {
        export libsqlite3_cv_is_recent=yes # Our DEPEND forces this.
        export ac_cv_header_keyutils_h=$(usex nfsidmap)
        local myeconfargs=(
-               --with-statedir="${EPREFIX%/}"/var/lib/nfs
+               --disable-static
+               --with-statedir="${EPREFIX}"/var/lib/nfs
                --enable-tirpc
-               --with-tirpcinclude="${EPREFIX%/}"/usr/include/tirpc/
-               --with-pluginpath="${EPREFIX%/}"/usr/$(get_libdir)/libnfsidmap
+               --with-tirpcinclude="${ESYSROOT}"/usr/include/tirpc/
+               --with-pluginpath="${EPREFIX}"/usr/$(get_libdir)/libnfsidmap
                --with-rpcgen
                --with-systemd="$(systemd_get_systemunitdir)"
                --without-gssglue
@@ -108,7 +122,7 @@ src_configure() {
        econf "${myeconfargs[@]}"
 }
 
-src_compile(){
+src_compile() {
        # remove compiled files bundled in the tarball
        emake clean
        default
@@ -122,13 +136,16 @@ src_install() {
        # Don't overwrite existing xtab/etab, install the original
        # versions somewhere safe...  more info in pkg_postinst
        keepdir /var/lib/nfs/{,sm,sm.bak}
-       mv "${ED%/}"/var/lib/nfs "${ED%/}"/usr/$(get_libdir)/ || die
+       mv "${ED}"/var/lib/nfs "${ED}"/usr/$(get_libdir)/ || die
 
        # Install some client-side binaries in /sbin
        dodir /sbin
-       mv "${ED%/}"/usr/sbin/rpc.statd "${ED%/}"/sbin/ || die
+       mv "${ED}"/usr/sbin/rpc.statd "${ED}"/sbin/ || die
 
        if use nfsv4 && use nfsidmap ; then
+               insinto /etc
+               doins support/nfsidmap/idmapd.conf
+
                # Install a config file for idmappers in newer kernels. #415625
                insinto /etc/request-key.d
                echo 'create id_resolver * * /usr/sbin/nfsidmap -t 600 %k %d' > 
id_resolver.conf
@@ -154,16 +171,18 @@ src_install() {
        done
        sed -i \
                -e "/^NFS_NEEDED_SERVICES=/s:=.*:=\"${opt_need}\":" \
-               "${ED%/}"/etc/conf.d/nfs || die #234132
+               "${ED}"/etc/conf.d/nfs || die #234132
 
        local systemd_systemunitdir="$(systemd_get_systemunitdir)"
        sed -i \
                -e 's:/usr/sbin/rpc.statd:/sbin/rpc.statd:' \
-               "${ED%/}${systemd_systemunitdir}"/* || die
+               "${ED}${systemd_systemunitdir}"/* || die
 
        keepdir /var/lib/nfs #368505
        keepdir /var/lib/nfs/v4recovery #603628
 
+       # no static archives
+       find "${ED}" -name '*.la' -delete || die
 }
 
 pkg_postinst() {
@@ -171,19 +190,21 @@ pkg_postinst() {
        # src_install we put them in /usr/lib/nfs for safe-keeping, but
        # the daemons actually use the files in /var/lib/nfs.  #30486
        local f
-       for f in "${EROOT%/}"/usr/$(get_libdir)/nfs/*; do
-               [[ -e ${EROOT%/}/var/lib/nfs/${f##*/} ]] && continue
+       for f in "${EROOT}"/usr/$(get_libdir)/nfs/*; do
+               [[ -e ${EROOT}/var/lib/nfs/${f##*/} ]] && continue
                einfo "Copying default ${f##*/} from 
${EPREFIX}/usr/$(get_libdir)/nfs to ${EPREFIX}/var/lib/nfs"
-               cp -pPR "${f}" "${EROOT%/}"/var/lib/nfs/
+               cp -pPR "${f}" "${EROOT}"/var/lib/nfs/
        done
 
        if systemd_is_booted; then
-               if [[ ${REPLACING_VERSIONS} < 1.3.0 ]]; then
-                       ewarn "We have switched to upstream systemd unit files. 
Since"
-                       ewarn "they got renamed, you should probably enable the 
new ones."
-                       ewarn "You can run 'equery files nfs-utils | grep 
systemd'"
-                       ewarn "to know what services you need to enable now."
-               fi
+               for v in ${REPLACING_VERSIONS}; do
+                       if ver_test "${v}" -lt 1.3.0; then
+                               ewarn "We have switched to upstream systemd 
unit files. Since"
+                               ewarn "they got renamed, you should probably 
enable the new ones."
+                               ewarn "You can run 'equery files nfs-utils | 
grep systemd'"
+                               ewarn "to know what services you need to enable 
now."
+                       fi
+               done
        else
                ewarn "If you use OpenRC, the nfsmount service has been 
replaced with nfsclient."
                ewarn "If you were using nfsmount, please add nfsclient and 
netmount to the"

Reply via email to