commit:     90e0563776003912817eb5b9c8df4780522a3843
Author:     Necktwi Ozfguah <necktwi <AT> ferryfair <DOT> com>
AuthorDate: Wed May  8 13:27:07 2019 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Wed May  8 20:39:19 2019 +0000
URL:        https://gitweb.gentoo.org/proj/musl.git/commit/?id=90e05637

net-fs/nfs-utils: version bump to 2.3.3 & getaddrinfo nullptr fix

getaddrinfo nullptr exportfs segfault fix is provided by awilfox@#musl

Signed-off-by: Necktwi Ozfguah <necktwi <AT> ferryfair.com>
Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>

 net-fs/nfs-utils/Manifest                   |   1 +
 net-fs/nfs-utils/files/nfs-utils-musl.patch | 126 ++++++++++++++++++
 net-fs/nfs-utils/nfs-utils-2.3.3.ebuild     | 192 ++++++++++++++++++++++++++++
 3 files changed, 319 insertions(+)

diff --git a/net-fs/nfs-utils/Manifest b/net-fs/nfs-utils/Manifest
index 47f42dd..3196928 100644
--- a/net-fs/nfs-utils/Manifest
+++ b/net-fs/nfs-utils/Manifest
@@ -1,2 +1,3 @@
 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

diff --git a/net-fs/nfs-utils/files/nfs-utils-musl.patch 
b/net-fs/nfs-utils/files/nfs-utils-musl.patch
index 19c42b1..e880072 100644
--- a/net-fs/nfs-utils/files/nfs-utils-musl.patch
+++ b/net-fs/nfs-utils/files/nfs-utils-musl.patch
@@ -19,3 +19,129 @@
  
  #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/nfs-utils-2.3.3.ebuild 
b/net-fs/nfs-utils/nfs-utils-2.3.3.ebuild
new file mode 100644
index 0000000..a324c7e
--- /dev/null
+++ b/net-fs/nfs-utils/nfs-utils-2.3.3.ebuild
@@ -0,0 +1,192 @@
+# Copyright 1999-2019 Gentoo Authors
+# 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="alpha amd64 arm arm64 hppa ia64 ~mips ppc ppc64 s390 sh sparc 
x86"
+fi
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="caps ipv6 junction 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}
+       dev-libs/libxml2
+       net-libs/rpcsvc-proto
+       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
+)
+
+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-rpcgen
+               --with-systemd="$(systemd_get_systemunitdir)"
+               --without-gssglue
+               $(use_enable caps)
+               $(use_enable ipv6)
+               $(use_enable junction)
+               $(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
+}

Reply via email to