Gentoo Archives: gentoo-commits

From: "Anthony G. Basile" <blueness@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/musl:master commit in: net-fs/nfs-utils/, net-fs/nfs-utils/files/
Date: Wed, 08 May 2019 20:41:48
Message-Id: 1557347959.90e0563776003912817eb5b9c8df4780522a3843.blueness@gentoo
1 commit: 90e0563776003912817eb5b9c8df4780522a3843
2 Author: Necktwi Ozfguah <necktwi <AT> ferryfair <DOT> com>
3 AuthorDate: Wed May 8 13:27:07 2019 +0000
4 Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
5 CommitDate: Wed May 8 20:39:19 2019 +0000
6 URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=90e05637
7
8 net-fs/nfs-utils: version bump to 2.3.3 & getaddrinfo nullptr fix
9
10 getaddrinfo nullptr exportfs segfault fix is provided by awilfox@#musl
11
12 Signed-off-by: Necktwi Ozfguah <necktwi <AT> ferryfair.com>
13 Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>
14
15 net-fs/nfs-utils/Manifest | 1 +
16 net-fs/nfs-utils/files/nfs-utils-musl.patch | 126 ++++++++++++++++++
17 net-fs/nfs-utils/nfs-utils-2.3.3.ebuild | 192 ++++++++++++++++++++++++++++
18 3 files changed, 319 insertions(+)
19
20 diff --git a/net-fs/nfs-utils/Manifest b/net-fs/nfs-utils/Manifest
21 index 47f42dd..3196928 100644
22 --- a/net-fs/nfs-utils/Manifest
23 +++ b/net-fs/nfs-utils/Manifest
24 @@ -1,2 +1,3 @@
25 DIST nfs-utils-1.3.4.tar.bz2 814545 BLAKE2B 4b8c5fa4c1c21858e19d05f973c6d94185cf6a15c88348dda5e47c6714f9dba00dfa05237d908479970440b2ea57287600e92cb4d49872127b3801e075d6bf1a SHA512 765c0bc55a9a0bdb2c25d8fb7189a9054fb9f2dd51726eda29f44e5d5c423e245b02307dfcfab9239276d8f44869a72732416f6e9ef5a1f80753d9243ba1b38c
26 DIST nfs-utils-2.3.1.tar.bz2 854899 BLAKE2B f9541b9dc103d978f21d57d8ba0c14a3b30f6ba874b112239d014076c1c72b6654e8e02b4bfea686e658dac84d1e896b872bc2054591275ef1713ae4e7b7d005 SHA512 de3e70f8656bc5b5aa98262685a9e80929c6314234d9bbb74d4c7efcb7a8b2640d48d2100850b403157ebefc8f0eb48598b48238fae795f64c7a0e9a8bff93e3
27 +DIST nfs-utils-2.3.3.tar.bz2 888947 BLAKE2B 7c913f0c5061807d4af162fb392c8f466abb97c88960853b52298f61056bcad08f67a16e577036dec9afa737d88268d5a766b67c4b30a014b666dfbf3db81031 SHA512 266b86ef5041a7ecd144c6f2570e8a6eb00ebb4e547fa4b8c8c3e60a4af117c2690ff9effb0d4113a7b7ef57164583c8a6ada9cb1bb8f7b748524c826eaf1cba
28
29 diff --git a/net-fs/nfs-utils/files/nfs-utils-musl.patch b/net-fs/nfs-utils/files/nfs-utils-musl.patch
30 index 19c42b1..e880072 100644
31 --- a/net-fs/nfs-utils/files/nfs-utils-musl.patch
32 +++ b/net-fs/nfs-utils/files/nfs-utils-musl.patch
33 @@ -19,3 +19,129 @@
34
35 #include "xlog.h"
36 #include "misc.h"
37 +diff -Naur nfs-utils-2.3.3-orig/support/export/client.c nfs-utils-2.3.3/support/export/client.c
38 +--- nfs-utils-2.3.3-orig/support/export/client.c 2018-09-06 13:09:08.000000000 -0500
39 ++++ nfs-utils-2.3.3/support/export/client.c 2019-04-21 02:48:45.676838188 -0500
40 +@@ -309,7 +309,8 @@
41 + init_addrlist(clp, ai);
42 +
43 + out:
44 +- freeaddrinfo(ai);
45 ++ if (ai != NULL)
46 ++ freeaddrinfo(ai);
47 + return clp;
48 + }
49 +
50 +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
51 +--- nfs-utils-2.3.3-orig/tests/nsm_client/nsm_client.c 2018-09-06 13:09:08.000000000 -0500
52 ++++ nfs-utils-2.3.3/tests/nsm_client/nsm_client.c 2019-04-21 02:35:53.139552780 -0500
53 +@@ -243,7 +243,8 @@
54 + printf("RPC client creation failed\n");
55 + }
56 + out:
57 +- freeaddrinfo(ai);
58 ++ if (ai != NULL)
59 ++ freeaddrinfo(ai);
60 + return client;
61 + }
62 +
63 +diff -Naur nfs-utils-2.3.3-orig/utils/exportfs/exportfs.c nfs-utils-2.3.3/utils/exportfs/exportfs.c
64 +--- nfs-utils-2.3.3-orig/utils/exportfs/exportfs.c 2018-09-06 13:09:08.000000000 -0500
65 ++++ nfs-utils-2.3.3/utils/exportfs/exportfs.c 2019-04-21 02:40:07.432327005 -0500
66 +@@ -282,7 +282,8 @@
67 + validate_export(exp);
68 +
69 + out:
70 +- freeaddrinfo(ai);
71 ++ if (ai != NULL)
72 ++ freeaddrinfo(ai);
73 + }
74 +
75 + static int exportfs_generic(char *arg, char *options, int verbose)
76 +@@ -395,7 +396,8 @@
77 + if (!success)
78 + xlog(L_ERROR, "Could not find '%s:%s' to unexport.", hname, path);
79 +
80 +- freeaddrinfo(ai);
81 ++ if (ai != NULL)
82 ++ freeaddrinfo(ai);
83 + }
84 +
85 + static int unexportfs_generic(char *arg, int verbose)
86 +@@ -639,8 +641,10 @@
87 + }
88 +
89 + out:
90 +- freeaddrinfo(results1);
91 +- freeaddrinfo(results2);
92 ++ if (results1 != NULL)
93 ++ freeaddrinfo(results1);
94 ++ if (results2 != NULL)
95 ++ freeaddrinfo(results2);
96 + return result;
97 + }
98 +
99 +diff -Naur nfs-utils-2.3.3-orig/utils/mount/stropts.c nfs-utils-2.3.3/utils/mount/stropts.c
100 +--- nfs-utils-2.3.3-orig/utils/mount/stropts.c 2018-09-06 13:09:08.000000000 -0500
101 ++++ nfs-utils-2.3.3/utils/mount/stropts.c 2019-04-21 02:43:18.451874403 -0500
102 +@@ -1263,7 +1263,8 @@
103 + } else
104 + nfs_error(_("%s: internal option parsing error"), progname);
105 +
106 +- freeaddrinfo(mi.address);
107 ++ if (mi.address != NULL)
108 ++ freeaddrinfo(mi.address);
109 + free(mi.hostname);
110 + return retval;
111 + }
112 +diff -Naur nfs-utils-2.3.3-orig/utils/mountd/cache.c nfs-utils-2.3.3/utils/mountd/cache.c
113 +--- nfs-utils-2.3.3-orig/utils/mountd/cache.c 2019-04-21 02:33:43.603417171 -0500
114 ++++ nfs-utils-2.3.3/utils/mountd/cache.c 2019-04-21 02:45:11.289792765 -0500
115 +@@ -834,7 +834,8 @@
116 + out:
117 + if (found_path)
118 + free(found_path);
119 +- freeaddrinfo(ai);
120 ++ if (ai != NULL)
121 ++ freeaddrinfo(ai);
122 + free(dom);
123 + xlog(D_CALL, "nfsd_fh: found %p path %s", found, found ? found->e_path : NULL);
124 + }
125 +@@ -1355,7 +1356,7 @@
126 + xlog(D_CALL, "nfsd_export: found %p path %s", found, path ? path : NULL);
127 + if (dom) free(dom);
128 + if (path) free(path);
129 +- freeaddrinfo(ai);
130 ++ if (ai) freeaddrinfo(ai);
131 + }
132 +
133 +
134 +diff -Naur nfs-utils-2.3.3-orig/utils/mountd/mountd.c nfs-utils-2.3.3/utils/mountd/mountd.c
135 +--- nfs-utils-2.3.3-orig/utils/mountd/mountd.c 2018-09-06 13:09:08.000000000 -0500
136 ++++ nfs-utils-2.3.3/utils/mountd/mountd.c 2019-04-21 02:45:41.796526387 -0500
137 +@@ -581,7 +581,8 @@
138 + freeaddrinfo(ai);
139 + continue;
140 + }
141 +- freeaddrinfo(ai);
142 ++ if (ai != NULL)
143 ++ freeaddrinfo(ai);
144 + }
145 + cp = &(c->gr_next);
146 + }
147 +diff -Naur nfs-utils-2.3.3-orig/utils/statd/hostname.c nfs-utils-2.3.3/utils/statd/hostname.c
148 +--- nfs-utils-2.3.3-orig/utils/statd/hostname.c 2018-09-06 13:09:08.000000000 -0500
149 ++++ nfs-utils-2.3.3/utils/statd/hostname.c 2019-04-21 02:41:39.712446505 -0500
150 +@@ -308,8 +308,10 @@
151 + }
152 +
153 + out:
154 +- freeaddrinfo(results2);
155 +- freeaddrinfo(results1);
156 ++ if (results2 != NULL)
157 ++ freeaddrinfo(results2);
158 ++ if (results1 != NULL)
159 ++ freeaddrinfo(results1);
160 +
161 + xlog(D_CALL, "%s: hostnames %s and %s %s", __func__,
162 + hostname1, hostname2,
163
164 diff --git a/net-fs/nfs-utils/nfs-utils-2.3.3.ebuild b/net-fs/nfs-utils/nfs-utils-2.3.3.ebuild
165 new file mode 100644
166 index 0000000..a324c7e
167 --- /dev/null
168 +++ b/net-fs/nfs-utils/nfs-utils-2.3.3.ebuild
169 @@ -0,0 +1,192 @@
170 +# Copyright 1999-2019 Gentoo Authors
171 +# Distributed under the terms of the GNU General Public License v2
172 +
173 +EAPI=6
174 +
175 +inherit autotools flag-o-matic multilib systemd
176 +
177 +DESCRIPTION="NFS client and server daemons"
178 +HOMEPAGE="http://linux-nfs.org/"
179 +
180 +if [[ "${PV}" = *_rc* ]] ; then
181 + inherit versionator
182 + MY_PV="$(replace_all_version_separators -)"
183 + 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"
184 + S="${WORKDIR}/${PN}-${PN}-${MY_PV}"
185 +else
186 + SRC_URI="mirror://sourceforge/nfs/${P}.tar.bz2"
187 + KEYWORDS="alpha amd64 arm arm64 hppa ia64 ~mips ppc ppc64 s390 sh sparc x86"
188 +fi
189 +
190 +LICENSE="GPL-2"
191 +SLOT="0"
192 +IUSE="caps ipv6 junction kerberos ldap +libmount nfsdcld +nfsidmap +nfsv4 nfsv41 selinux tcpd +uuid"
193 +REQUIRED_USE="kerberos? ( nfsv4 )"
194 +RESTRICT="test" #315573
195 +
196 +# kth-krb doesn't provide the right include
197 +# files, and nfs-utils doesn't build against heimdal either,
198 +# so don't depend on virtual/krb.
199 +# (04 Feb 2005 agriffis)
200 +DEPEND_COMMON="
201 + net-libs/libtirpc:=
202 + >=net-nds/rpcbind-0.2.4
203 + sys-libs/e2fsprogs-libs
204 + caps? ( sys-libs/libcap )
205 + ldap? ( net-nds/openldap )
206 + libmount? ( sys-apps/util-linux )
207 + nfsdcld? ( >=dev-db/sqlite-3.3 )
208 + nfsv4? (
209 + dev-libs/libevent:=
210 + >=sys-apps/keyutils-1.5.9
211 + kerberos? (
212 + >=net-libs/libtirpc-0.2.4-r1[kerberos]
213 + app-crypt/mit-krb5
214 + )
215 + )
216 + nfsv41? (
217 + sys-fs/lvm2
218 + )
219 + tcpd? ( sys-apps/tcp-wrappers )
220 + uuid? ( sys-apps/util-linux )"
221 +RDEPEND="${DEPEND_COMMON}
222 + !net-libs/libnfsidmap
223 + !net-nds/portmap
224 + !<sys-apps/openrc-0.13.9
225 + selinux? (
226 + sec-policy/selinux-rpc
227 + sec-policy/selinux-rpcbind
228 + )
229 +"
230 +DEPEND="${DEPEND_COMMON}
231 + dev-libs/libxml2
232 + net-libs/rpcsvc-proto
233 + virtual/pkgconfig"
234 +
235 +PATCHES=(
236 + "${FILESDIR}"/${PN}-1.1.4-mtab-sym.patch
237 + "${FILESDIR}"/${PN}-1.2.8-cross-build.patch
238 + "${FILESDIR}"/${PN}-2.3.2-junction_libs.patch
239 + "${FILESDIR}"/${PN}-2.3.2-no-werror.patch
240 + "${FILESDIR}"/${PN}-musl.patch
241 +)
242 +
243 +src_prepare() {
244 + default
245 +
246 + sed \
247 + -e "/^sbindir/s:= := \"${EPREFIX}\":g" \
248 + -i utils/*/Makefile.am || die
249 +
250 + eautoreconf
251 +}
252 +
253 +src_configure() {
254 + export libsqlite3_cv_is_recent=yes # Our DEPEND forces this.
255 + export ac_cv_header_keyutils_h=$(usex nfsidmap)
256 + local myeconfargs=(
257 + --with-statedir="${EPREFIX%/}"/var/lib/nfs
258 + --enable-tirpc
259 + --with-tirpcinclude="${EPREFIX%/}"/usr/include/tirpc/
260 + --with-pluginpath="${EPREFIX%/}"/usr/$(get_libdir)/libnfsidmap
261 + --with-rpcgen
262 + --with-systemd="$(systemd_get_systemunitdir)"
263 + --without-gssglue
264 + $(use_enable caps)
265 + $(use_enable ipv6)
266 + $(use_enable junction)
267 + $(use_enable kerberos gss)
268 + $(use_enable kerberos svcgss)
269 + $(use_enable ldap)
270 + $(use_enable libmount libmount-mount)
271 + $(use_enable nfsdcld nfsdcltrack)
272 + $(use_enable nfsv4)
273 + $(use_enable nfsv41)
274 + $(use_enable uuid)
275 + $(use_with tcpd tcp-wrappers)
276 + )
277 + econf "${myeconfargs[@]}"
278 +}
279 +
280 +src_compile(){
281 + # remove compiled files bundled in the tarball
282 + emake clean
283 + default
284 +}
285 +
286 +src_install() {
287 + default
288 + rm linux-nfs/Makefile* || die
289 + dodoc -r linux-nfs README
290 +
291 + # Don't overwrite existing xtab/etab, install the original
292 + # versions somewhere safe... more info in pkg_postinst
293 + keepdir /var/lib/nfs/{,sm,sm.bak}
294 + mv "${ED%/}"/var/lib/nfs "${ED%/}"/usr/$(get_libdir)/ || die
295 +
296 + # Install some client-side binaries in /sbin
297 + dodir /sbin
298 + mv "${ED%/}"/usr/sbin/rpc.statd "${ED%/}"/sbin/ || die
299 +
300 + if use nfsv4 && use nfsidmap ; then
301 + # Install a config file for idmappers in newer kernels. #415625
302 + insinto /etc/request-key.d
303 + echo 'create id_resolver * * /usr/sbin/nfsidmap -t 600 %k %d' > id_resolver.conf
304 + doins id_resolver.conf
305 + fi
306 +
307 + insinto /etc
308 + doins "${FILESDIR}"/exports
309 + keepdir /etc/exports.d
310 +
311 + local f list=() opt_need=""
312 + if use nfsv4 ; then
313 + opt_need="rpc.idmapd"
314 + list+=( rpc.idmapd rpc.pipefs )
315 + use kerberos && list+=( rpc.gssd rpc.svcgssd )
316 + fi
317 + for f in nfs nfsclient rpc.statd "${list[@]}" ; do
318 + newinitd "${FILESDIR}"/${f}.initd ${f}
319 + done
320 + newinitd "${FILESDIR}"/nfsmount.initd-1.3.1 nfsmount # Nuke after 2015/08/01
321 + for f in nfs nfsclient ; do
322 + newconfd "${FILESDIR}"/${f}.confd ${f}
323 + done
324 + sed -i \
325 + -e "/^NFS_NEEDED_SERVICES=/s:=.*:=\"${opt_need}\":" \
326 + "${ED%/}"/etc/conf.d/nfs || die #234132
327 +
328 + local systemd_systemunitdir="$(systemd_get_systemunitdir)"
329 + sed -i \
330 + -e 's:/usr/sbin/rpc.statd:/sbin/rpc.statd:' \
331 + "${ED%/}${systemd_systemunitdir}"/* || die
332 +
333 + keepdir /var/lib/nfs #368505
334 + keepdir /var/lib/nfs/v4recovery #603628
335 +
336 +}
337 +
338 +pkg_postinst() {
339 + # Install default xtab and friends if there's none existing. In
340 + # src_install we put them in /usr/lib/nfs for safe-keeping, but
341 + # the daemons actually use the files in /var/lib/nfs. #30486
342 + local f
343 + for f in "${EROOT%/}"/usr/$(get_libdir)/nfs/*; do
344 + [[ -e ${EROOT%/}/var/lib/nfs/${f##*/} ]] && continue
345 + einfo "Copying default ${f##*/} from ${EPREFIX}/usr/$(get_libdir)/nfs to ${EPREFIX}/var/lib/nfs"
346 + cp -pPR "${f}" "${EROOT%/}"/var/lib/nfs/
347 + done
348 +
349 + if systemd_is_booted; then
350 + if [[ ${REPLACING_VERSIONS} < 1.3.0 ]]; then
351 + ewarn "We have switched to upstream systemd unit files. Since"
352 + ewarn "they got renamed, you should probably enable the new ones."
353 + ewarn "You can run 'equery files nfs-utils | grep systemd'"
354 + ewarn "to know what services you need to enable now."
355 + fi
356 + else
357 + ewarn "If you use OpenRC, the nfsmount service has been replaced with nfsclient."
358 + ewarn "If you were using nfsmount, please add nfsclient and netmount to the"
359 + ewarn "same runlevel as nfsmount."
360 + fi
361 +}