Changeset - c5064d653531
[Not reviewed]
0 1 2
Chel Sea (chain) - 3 years ago 2021-06-11 19:58:16
chain@rpgfiction.net
net-fs/nfs-utils: fix copmpilation with -fno-common or gcc10, fixes bug #707624
3 files changed with 295 insertions and 0 deletions:
0 comments (0 inline, 0 general)
net-fs/nfs-utils/Manifest
Show inline comments
 
@@ -3,6 +3,7 @@ AUX nfs-utils-1.1.4-mtab-sym.patch 1020 BLAKE2B 6f1315a02a6070443fbd8cc943e382a0
 
AUX nfs-utils-1.2.8-cross-build.patch 2112 BLAKE2B f1cd8457eeb869c5830b775b65bc2d0bc8bcc4ef832cb4fcc30366f7978271cbb9f9e92c7a25b2a392dd3b11690f10a87db09ce1c4d51d800eb231aeef5bc706 SHA512 d4b5cfa9f3a210aff09749aead376f698c5a8ba1cb7403eea95d52e423f4d5f039e9d6d6f6a1b0bff5439fff5048b7abd2c509a42cd8b977352c840876ccbf3c
 
AUX nfs-utils-2.3.2-junction_libs.patch 1487 BLAKE2B 5ecd4709fdcbc1c0885c91aea134ef5e5e00e6f58ace39d35d31b5de74d73bf05a4c27befc35f2c8a54d72452f63589c3a2912c3ef37752416389dd9537598e8 SHA512 d724ff25b7bbf03fc2c7d122bb338979ef50c59906a433ced5aa50e84030a375b2c268a05ee930c4f64ce58e938de7d30a9d0b5d3b7e660d8894013786d5bb4f
 
AUX nfs-utils-2.3.2-no-werror.patch 1375 BLAKE2B d494d00f81e236fd0531d4629108a4536415e3a6898b655f267b0125c0fd6b87cb567ef5cb7598fc19e68653572c1072566d7ef791fedb9f0c8d9ea663e67565 SHA512 acc3ccd6cf4afa73bbd253f6a1faa0349e6f8d50d57d9316fafa1faeb9f8ed5d5dfa60ec1b0a53339cd71af4d65b32d9595965ec435bc72eadcc86b8d187438b
 
AUX nfs-utils-2.3.4-no-common.patch 2849 BLAKE2B 54abbfa1844500798bbe68065ba985429d21cb9e9272784a15e6d5f0184fa24911c9418e1de9df3943e4de3e327e07f533c6c005b6993b5c9f96f54285b9b756 SHA512 01b9fea7f3602b1d56733071da49a02662c38ab4a1bfdae2f8ef5381344fdbfa87c036aa3aed5c09a7fd29d0e56aa836f2f740e4a2b798ffa9d580459ac08ccf
 
AUX nfs-utils-2.3.4-no-werror.patch 1832 BLAKE2B 6e0f3da6a355c3b828bbaae3135c3a6c8bab29008cf160ca728ff5b72402f108221b4def304e9bf36f98310407bee9c26d828ab833bb7a9619fdaf609e66d06c SHA512 ce76f46c8dcef8b151040b9d198843746b6c20507c23a0dc511b3d3dec7681b3ac65c089de3f09d4e496ffa1bd011c034ce70198def374058a0805daf4ec8292
 
AUX nfs-utils-2.4.1-Fix-include-order-between-config.h-and-stat.h.patch 4020 BLAKE2B 9f9079879be7bbaaf7748d4c2e5711fdeacac8b389fdb48d7fdc1c781191dc283f2dc05c9aded7558eb0cf3801cf7eda7032d091592e45cb8eb47018a0ce5430 SHA512 36b80e0f1ef0826e25ee719980171f4d6215db246392e1dbceef6aab4f1fbe78e4e1222256dfb23232b7da1b5328a23050966f3608a10c8b70b2f75491603f31
 
AUX nfs-utils-2.4.1-gssd-Look-in-lib32-for-gss-libs-aswell.patch 1608 BLAKE2B 761eb16d6556b0df1029556453922925ccac7bdc88c4f769382afdf659dfccdd90aa6a183d317667c638e2d2d4d8fc080cfe49070c5fec5bb5f5dc2f66d2040e SHA512 cc4a7a7dde84854b52f57afe09bbff9e241712a19784febd0992b5b53b4b14905b6daf6620a8e9049fbda1dfe0a1619f322adc0517d9747466d7974d4c3eac06
 
@@ -27,5 +28,6 @@ AUX rpc.svcgssd.initd 470 BLAKE2B c610a7abc44b86ca242d59f833ffa6e42f48d1c3bf9342
 
DIST nfs-utils-2.3.2.tar.bz2 884068 BLAKE2B c4133cc12c5c1cd33346408e2d1286cf50880a89ec97cb8ce4453266ba5b145eb1ca7a4362ac1a91ea5c1ebddd4fcd1d6a4cd12f45637cd5d845cc6d8d5f139d SHA512 4b948d92f515e9340163f53ab26dd7189fa8b13909f5c668b7c66ae13f181ed778967edc0a20753763540b5a3f93a41a2de38a7276ffbfadfd866c5ed422520c
 
DIST nfs-utils-2.3.4.tar.bz2 906900 BLAKE2B 968fac7b37c7311bc8d29667c88db925aac0c062ed7ef8c13f9e5c11c3c88960ffaea56c1b6cfb5594a01238f9190e55ab7b837a79a7a804bc55dcca75908eea SHA512 25203b38be6683f25ad6583ac8534873c907124092a768955c1454899e2f467b9dd427b167556eb4f28992b5720da13078eb1eb086da991438454f268e1559a5
 
EBUILD nfs-utils-2.3.2.ebuild 5346 BLAKE2B fcf2e6f977ac80cf34433c1c46be5291e3b02c986215bc83acad00225e42e3201f01dde1a7eaaac270c9f6ec1058dc3ce8c95c77ed626ea3149be6579f72a856 SHA512 8ada0b5fe90cae49d99c0b02e2162585e7c681ee8e9a1da48e0656aa339bfad11b269a4a718cf7b25beae3ad781cac5f163265c09d3c76ecf408e61a18d6e889
 
EBUILD nfs-utils-2.3.4-r1.ebuild 5267 BLAKE2B 3cfdc36c2baa7005be877129d8b420de16577b2d0d2eda05eebb6dd429ef5d5b4d7fe114831124bb7698db5e4a8e68711a3694c52b2d2493a0eaaf74eab3d5f2 SHA512 6a4ef77dfb0aafc711548afc58f8bc0cfa268059ebe5bb277c033f1e2c5dbe57194d641078bdcc5237e4aaeea99077b4c79c121ff9acaa0c117f3ed2129fe671
 
EBUILD nfs-utils-2.3.4.ebuild 5224 BLAKE2B d3875920a72f2c943b65c07e29c5237af45acbf241de116ed9adc07757221950143fe3e962ccf2ec0ea072bc6839fce7813addb204f3223a22fa5191a3b36969 SHA512 f84a0609b65c511b00c4d859916311465d512048182d7d2388708d47232b3fb60e402a605480da337fde593a96190b0654c14637dfc157fd7350d1c5cd8590dd
 
MISC metadata.xml 932 BLAKE2B 14cb95a010cdb52373502bdad4de008234494be6e38f6b3fbf6b69e0848a6daa1315ed69b8eaadaad0cd546e84ba0e291b56ebf9db486b7c6e66011147b9a97c SHA512 eb45c97d7ed2bdaa8e43ce0a4fdb2f8a1d197bfd67a8b04f718c6083e7701873e2c22550700049edc25068daacb5278ca2535b63a02a10c1040efe0dbcef76a5
net-fs/nfs-utils/files/nfs-utils-2.3.4-no-common.patch
Show inline comments
 
new file 100644
 
When compiled with -fno-common, global variables that are declared
 
multple times cause an error.  With -fcommon (the default), they are
 
merged.
 

	
 
Declaring such variable multiple times is probably not a good idea, and
 
is definitely not necessary.
 

	
 
This patch changes all the global variables defined in include files to
 
be explicitly "extern", and where necessary, adds the variable
 
declaration to a suitable .c file.
 

	
 
To test, run
 
  CFLAGS=-fno-common ./configure
 
  make
 

	
 
Signed-off-by: NeilBrown <neilb@xxxxxxx>
 
---
 
 utils/mountd/v4root.c        |  2 --
 
 utils/nfsdcld/cld-internal.h | 10 +++++-----
 
 utils/nfsdcld/nfsdcld.c      |  6 ++++++
 
 utils/statd/statd.c          |  1 +
 
 utils/statd/statd.h          |  2 +-
 
 5 files changed, 13 insertions(+), 8 deletions(-)
 

	
 
diff --git a/utils/mountd/v4root.c b/utils/mountd/v4root.c
 
index d735dbfe192d..dd9828eb0c11 100644
 
--- a/utils/mountd/v4root.c
 
+++ b/utils/mountd/v4root.c
 
@@ -28,8 +28,6 @@
 
 #include "v4root.h"
 
 #include "pseudoflavors.h"
 
 
 
-int v4root_needed;
 
-
 
 static nfs_export pseudo_root = {
 
 	.m_next = NULL,
 
 	.m_client = NULL,
 
diff --git a/utils/nfsdcld/cld-internal.h b/utils/nfsdcld/cld-internal.h
 
index 05f01be2105a..cc283dae9dbf 100644
 
--- a/utils/nfsdcld/cld-internal.h
 
+++ b/utils/nfsdcld/cld-internal.h
 
@@ -35,10 +35,10 @@ struct cld_client {
 
 	} cl_u;
 
 };
 
 
 
-uint64_t current_epoch;
 
-uint64_t recovery_epoch;
 
-int first_time;
 
-int num_cltrack_records;
 
-int num_legacy_records;
 
+extern uint64_t current_epoch;
 
+extern uint64_t recovery_epoch;
 
+extern int first_time;
 
+extern int num_cltrack_records;
 
+extern int num_legacy_records;
 
 
 
 #endif /* _CLD_INTERNAL_H_ */
 
diff --git a/utils/nfsdcld/nfsdcld.c b/utils/nfsdcld/nfsdcld.c
 
index 2ad1001988d2..be6556262504 100644
 
--- a/utils/nfsdcld/nfsdcld.c
 
+++ b/utils/nfsdcld/nfsdcld.c
 
@@ -69,6 +69,12 @@ static int 		inotify_fd = -1;
 
 static struct event	pipedir_event;
 
 static bool old_kernel = false;
 
 
 
+uint64_t current_epoch;
 
+uint64_t recovery_epoch;
 
+int first_time;
 
+int num_cltrack_records;
 
+int num_legacy_records;
 
+
 
 static struct option longopts[] =
 
 {
 
 	{ "help", 0, NULL, 'h' },
 
diff --git a/utils/statd/statd.c b/utils/statd/statd.c
 
index 8eef2ff24fe8..e4a1df43b73f 100644
 
--- a/utils/statd/statd.c
 
+++ b/utils/statd/statd.c
 
@@ -67,6 +67,7 @@ static struct option longopts[] =
 
 };
 
 
 
 extern void sm_prog_1 (struct svc_req *, register SVCXPRT *);
 
+stat_chge	SM_stat_chge;
 
 
 
 #ifdef SIMULATIONS
 
 extern void simulator (int, char **);
 
diff --git a/utils/statd/statd.h b/utils/statd/statd.h
 
index 231ac7e0764b..bb1fecbb6a51 100644
 
--- a/utils/statd/statd.h
 
+++ b/utils/statd/statd.h
 
@@ -41,7 +41,7 @@ extern void	load_state(void);
 
 /*
 
  * Host status structure and macros.
 
  */
 
-stat_chge		SM_stat_chge;
 
+extern stat_chge	SM_stat_chge;
 
 #define MY_NAME		SM_stat_chge.mon_name
 
 #define MY_STATE	SM_stat_chge.state
 
 
 
-- 
 
2.24.1
 

	
net-fs/nfs-utils/nfs-utils-2.3.4-r1.ebuild
Show inline comments
 
new file 100644
 
# Copyright 1999-2020 Gentoo Authors
 
# Distributed under the terms of the GNU General Public License v2
 

	
 
EAPI=7
 

	
 
inherit autotools flag-o-matic multilib systemd
 

	
 
DESCRIPTION="NFS client and server daemons"
 
HOMEPAGE="http://linux-nfs.org/"
 

	
 
if [[ "${PV}" = *_rc* ]] ; then
 
	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="~alpha amd64 arm arm64 hppa ~ia64 ~mips ppc ppc64 ~riscv s390 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="
 
	>=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 )
 
	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}
 
	!net-libs/libnfsidmap
 
	!net-nds/portmap
 
	!<sys-apps/openrc-0.13.9
 
	selinux? (
 
		sec-policy/selinux-rpc
 
		sec-policy/selinux-rpcbind
 
	)
 
"
 
BDEPEND="
 
	virtual/pkgconfig
 
"
 

	
 
PATCHES=(
 
	"${FILESDIR}"/${PN}-1.1.4-mtab-sym.patch
 
	"${FILESDIR}"/${PN}-1.2.8-cross-build.patch
 
	"${FILESDIR}"/${PN}-2.3.4-no-werror.patch
 
	"${FILESDIR}"/${PN}-2.3.4-no-common.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 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
 
		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"
 
		ewarn "same runlevel as nfsmount."
 
	fi
 
}
0 comments (0 inline, 0 general)