diff options
author | Benedikt Boehm <hollow@gentoo.org> | 2009-03-24 09:26:04 +0000 |
---|---|---|
committer | Benedikt Boehm <hollow@gentoo.org> | 2009-03-24 09:26:04 +0000 |
commit | 74c544c957b44c6c46e59f907ee641919eb803d5 (patch) | |
tree | 2176141d641708c25064d05807d18c4962eb899f /sys-cluster/util-vserver | |
parent | Version bump (#261462). Thanks to Kai Dietrich (diff) | |
download | gentoo-2-74c544c957b44c6c46e59f907ee641919eb803d5.tar.gz gentoo-2-74c544c957b44c6c46e59f907ee641919eb803d5.tar.bz2 gentoo-2-74c544c957b44c6c46e59f907ee641919eb803d5.zip |
fix mmap problems wrt #228135
(Portage version: 2.2_rc25/cvs/Linux i686)
Diffstat (limited to 'sys-cluster/util-vserver')
4 files changed, 266 insertions, 1 deletions
diff --git a/sys-cluster/util-vserver/ChangeLog b/sys-cluster/util-vserver/ChangeLog index db7a2c5bdbef..d94a94314411 100644 --- a/sys-cluster/util-vserver/ChangeLog +++ b/sys-cluster/util-vserver/ChangeLog @@ -1,6 +1,14 @@ # ChangeLog for sys-cluster/util-vserver # Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-cluster/util-vserver/ChangeLog,v 1.95 2009/03/04 21:20:24 hollow Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-cluster/util-vserver/ChangeLog,v 1.96 2009/03/24 09:26:03 hollow Exp $ + +*util-vserver-0.30.215-r3 (24 Mar 2009) + + 24 Mar 2009; Benedikt Böhm <hollow@gentoo.org> + +files/util-vserver-0.30.215-2718.patch, + +files/util-vserver-0.30.215-dietmmap.patch, + +util-vserver-0.30.215-r3.ebuild: + fix mmap problems wrt #228135 *util-vserver-0.30.215-r2 (04 Mar 2009) diff --git a/sys-cluster/util-vserver/files/util-vserver-0.30.215-2718.patch b/sys-cluster/util-vserver/files/util-vserver-0.30.215-2718.patch new file mode 100644 index 000000000000..fc9ea6164fba --- /dev/null +++ b/sys-cluster/util-vserver/files/util-vserver-0.30.215-2718.patch @@ -0,0 +1,62 @@ +diff -Nru util-vserver-0.30.215.orig/lib_internal/unify-copy.c util-vserver-0.30.215/lib_internal/unify-copy.c +--- util-vserver-0.30.215.orig/lib_internal/unify-copy.c 2008-03-17 09:59:50.000000000 +0100 ++++ util-vserver-0.30.215/lib_internal/unify-copy.c 2008-06-17 15:38:50.000000000 +0200 +@@ -132,8 +132,8 @@ + buf_size = in_len - offset; + if (buf_size > MMAP_BLOCKSIZE) buf_size = MMAP_BLOCKSIZE; + +- if ((in_buf = mmap(0, buf_size, PROT_READ, MAP_SHARED, in_fd, offset))==0 || +- (out_buf = mmap(0, buf_size, PROT_WRITE, MAP_SHARED, out_fd, offset))==0) { ++ if ((in_buf = mmap(0, buf_size, PROT_READ, MAP_SHARED, in_fd, offset))==MAP_FAILED || ++ (out_buf = mmap(0, buf_size, PROT_WRITE, MAP_SHARED, out_fd, offset))==MAP_FAILED) { + perror("mmap()"); + goto out; + } +diff -Nru util-vserver-0.30.215.orig/src/check-unixfile.c util-vserver-0.30.215/src/check-unixfile.c +--- util-vserver-0.30.215.orig/src/check-unixfile.c 2008-03-17 09:59:45.000000000 +0100 ++++ util-vserver-0.30.215/src/check-unixfile.c 2008-06-17 15:39:11.000000000 +0200 +@@ -73,7 +73,7 @@ + } + else if (l>0) { + data = mmap(0, l, PROT_READ, MAP_PRIVATE, fd, 0); +- if (data==0) { ++ if (data==MAP_FAILED) { + perror("mmap()"); + exit(wrapper_exit_code); + } +diff -Nru util-vserver-0.30.215.orig/src/h2ext.c util-vserver-0.30.215/src/h2ext.c +--- util-vserver-0.30.215.orig/src/h2ext.c 2008-03-17 09:59:45.000000000 +0100 ++++ util-vserver-0.30.215/src/h2ext.c 2008-06-17 15:39:41.000000000 +0200 +@@ -148,7 +148,7 @@ + fd = EopenD(file, O_RDONLY, 0); + Efstat(fd, &st); + mapping = mmap(NULL, MIN(st.st_size, MAX_PEEK_SIZE), PROT_READ, MAP_SHARED, fd, 0); +- if (!mapping) { ++ if (mapping == MAP_FAILED) { + perror("mmap()"); + Eclose(fd); + return -1; +diff -Nru util-vserver-0.30.215.orig/src/testsuite/hashcalc-plain.c util-vserver-0.30.215/src/testsuite/hashcalc-plain.c +--- util-vserver-0.30.215.orig/src/testsuite/hashcalc-plain.c 2008-03-17 09:59:45.000000000 +0100 ++++ util-vserver-0.30.215/src/testsuite/hashcalc-plain.c 2008-06-17 15:40:08.000000000 +0200 +@@ -76,7 +76,7 @@ + void const * buf; + if (buf_size>HASH_BLOCKSIZE) buf_size = HASH_BLOCKSIZE; + +- assert((buf=mmap(0, buf_size, PROT_READ, MAP_SHARED, fd, offset))!=0); ++ assert((buf=mmap(0, buf_size, PROT_READ, MAP_SHARED, fd, offset))!=MAP_FAILED); + offset += buf_size; + assert(ensc_crypto_hashctx_update(&hash_context, buf, buf_size)!=-1); + munmap((void *)(buf), buf_size); +diff -Nru util-vserver-0.30.215.orig/src/vhashify.c util-vserver-0.30.215/src/vhashify.c +--- util-vserver-0.30.215.orig/src/vhashify.c 2008-03-17 09:59:45.000000000 +0100 ++++ util-vserver-0.30.215/src/vhashify.c 2008-06-17 15:40:28.000000000 +0200 +@@ -332,7 +332,7 @@ + buf_size = size-offset; + if (buf_size>HASH_BLOCKSIZE) buf_size = HASH_BLOCKSIZE; + +- if ((buf=mmap(0, buf_size, PROT_READ, MAP_SHARED, fd, offset))==0) { ++ if ((buf=mmap(0, buf_size, PROT_READ, MAP_SHARED, fd, offset))==MAP_FAILED) { + perror("mmap(<hash>)"); + goto out; + } diff --git a/sys-cluster/util-vserver/files/util-vserver-0.30.215-dietmmap.patch b/sys-cluster/util-vserver/files/util-vserver-0.30.215-dietmmap.patch new file mode 100644 index 000000000000..bb6342608c70 --- /dev/null +++ b/sys-cluster/util-vserver/files/util-vserver-0.30.215-dietmmap.patch @@ -0,0 +1,49 @@ +diff -Nru util-vserver-0.30.215.orig/Makefile.in util-vserver-0.30.215/Makefile.in +--- util-vserver-0.30.215.orig/Makefile.in 2008-03-17 10:00:13.000000000 +0100 ++++ util-vserver-0.30.215/Makefile.in 2008-06-18 19:24:54.000000000 +0200 +@@ -1496,7 +1496,7 @@ + $(lib_internal_testsuite_sigbus_gnu_SOURCES) \ + $(src_capchroot_SOURCES) $(src_chain_echo_SOURCES) \ + $(src_chbind_compat_SOURCES) $(src_chcontext_compat_SOURCES) \ +- src/check-unixfile.c $(src_chroot_sh_SOURCES) \ ++ $(src_chroot_sh_SOURCES) \ + $(src_chxid_SOURCES) $(src_exec_cd_SOURCES) \ + $(src_exec_ulimit_SOURCES) $(src_fakerunlevel_SOURCES) \ + $(src_filetime_SOURCES) $(src_h2ext_SOURCES) \ +@@ -1818,7 +1818,7 @@ + ensc_fmt/lib_libvserver_a-% lib/testsuite/cflags \ + lib/testsuite/personality lib/testsuite/fmt \ + src/chcontext-compat src/capchroot src/chain-echo \ +- src/check-unixfile src/chroot-sh src/filetime src/lockfile \ ++ src/chroot-sh src/filetime src/lockfile \ + src/readlink src/secure-mount src/save_ctxinfo src/mask2prefix \ + src/chbind-compat src/exec-cd src/fakerunlevel \ + src/keep-ctx-alive src/exec-ulimit src/vps src/lsxid src/chxid \ +@@ -1828,7 +1828,7 @@ + src/vsched src/vshelper-sync src/vrsetup src/vserver-stat \ + src/vserver-info src/vdlimit src/vdu src/vwait src/ncontext \ + src/nattribute src/naddress src/vdevmap src/vsysctl src/vclone \ +- src/h2ext src/vtag src/vspace src/vmemctrl src/tunctl \ ++ src/vtag src/vspace src/vmemctrl src/tunctl \ + $(am__append_3) $(tests_dietprogs) \ + lib_internal/libinternal-diet.a \ + lib_internal/testsuite/isnumber lib_internal/testsuite/sigbus \ +diff -Nru util-vserver-0.30.215.orig/src/Makefile-files util-vserver-0.30.215/src/Makefile-files +--- util-vserver-0.30.215.orig/src/Makefile-files 2008-03-17 09:59:45.000000000 +0100 ++++ util-vserver-0.30.215/src/Makefile-files 2008-06-18 17:49:42.000000000 +0200 +@@ -38,7 +38,6 @@ + DIETPROGS += src/chcontext-compat \ + src/capchroot \ + src/chain-echo \ +- src/check-unixfile \ + src/chroot-sh \ + src/filetime \ + src/lockfile \ +@@ -81,7 +80,6 @@ + src/vdevmap \ + src/vsysctl \ + src/vclone \ +- src/h2ext \ + src/vtag \ + src/vspace \ + src/vmemctrl \ diff --git a/sys-cluster/util-vserver/util-vserver-0.30.215-r3.ebuild b/sys-cluster/util-vserver/util-vserver-0.30.215-r3.ebuild new file mode 100644 index 000000000000..a30036dd5d74 --- /dev/null +++ b/sys-cluster/util-vserver/util-vserver-0.30.215-r3.ebuild @@ -0,0 +1,146 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-cluster/util-vserver/util-vserver-0.30.215-r3.ebuild,v 1.1 2009/03/24 09:26:03 hollow Exp $ + +inherit eutils bash-completion + +DESCRIPTION="Linux-VServer admin utilities" +HOMEPAGE="http://www.nongnu.org/util-vserver/" +SRC_URI="http://ftp.linux-vserver.org/pub/utils/${PN}/${P}.tar.bz2" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~hppa ~ppc ~sparc ~x86" + +IUSE="" + +CDEPEND="dev-libs/beecrypt + net-firewall/iptables + net-misc/vconfig + sys-apps/iproute2 + || ( >=sys-apps/coreutils-6.10-r1 sys-apps/mktemp )" + +DEPEND=">=dev-libs/dietlibc-0.30-r2 + ${CDEPEND}" + +RDEPEND="${CDEPEND}" + +pkg_setup() { + if [[ -z "${VDIRBASE}" ]]; then + einfo + einfo "You can change the default vserver base directory (/vservers)" + einfo "by setting the VDIRBASE environment variable." + fi + + : ${VDIRBASE:=/vservers} + + einfo + einfo "Using \"${VDIRBASE}\" as vserver base directory" + einfo +} + +src_unpack() { + unpack ${A} + cd "${S}" + + # openrc support + epatch "${FILESDIR}"/${P}-openrc.patch + epatch "${FILESDIR}"/${P}-typo.patch + + # linux capability fixes + epatch "${FILESDIR}"/${P}-capget.patch + + # changeset 2718: fix error reporting if mmap() fails + epatch "${FILESDIR}"/${P}-2718.patch + + # avoid a bug in dietlibc - #227793 + use hppa && epatch "${FILESDIR}"/${P}-dietmmap.patch +} + +src_compile() { + econf --with-vrootdir=${VDIRBASE} \ + --with-initscripts=gentoo \ + --localstatedir=/var || die "econf failed!" + emake || die "emake failed!" +} + +src_install() { + make DESTDIR="${D}" install install-distribution \ + || die "make install failed!" + + # keep dirs + keepdir /var/run/vservers + keepdir /var/run/vservers.rev + keepdir /var/run/vshelper + keepdir /var/lock/vservers + keepdir /var/cache/vservers + keepdir "${VDIRBASE}" + keepdir "${VDIRBASE}"/.pkg + + # remove legacy config file + rm -f "${D}"/etc/vservers.conf + + # bash-completion + dobashcompletion "${FILESDIR}"/bash_completion util-vserver + + dodoc README ChangeLog NEWS AUTHORS THANKS util-vserver.spec +} + +pkg_preinst() { + has_version "<${CATEGORY}/${PN}-0.30.211" + old_init_script_warn=$? +} + +pkg_postinst() { + # Create VDIRBASE in postinst, so it is (a) not unmerged and (b) also + # present when merging. + + [ ! -d "${VDIRBASE}" ] && mkdir -p "${VDIRBASE}" &> /dev/null + setattr --barrier "${VDIRBASE}" &> /dev/null + + rm /etc/vservers/.defaults/vdirbase + ln -sf "${VDIRBASE}" /etc/vservers/.defaults/vdirbase + + elog + elog "You have to run the vprocunhide command after every reboot" + elog "in order to setup /proc permissions correctly for vserver" + elog "use. An init script has been installed by this package." + elog "To use it you should add it to a runlevel:" + elog + elog " rc-update add vprocunhide default" + elog + + if [[ $old_init_script_warn = 0 ]] ; then + ewarn "Please make sure, that you remove the old init-script from any" + ewarn "runlevel and remove it from your init.d dir!" + ewarn + ewarn "# rc-update del vservers" + ewarn "# rm -f ${ROOT}etc/init.d/vservers" + ewarn + ewarn "Since util-vserver-0.30.211 all Gentoo specific wrappers" + ewarn "have been merged upstream, and may now have a slightly" + ewarn "different syntax, i.e. you have to update scripts that" + ewarn "depend on these wrappers (vesync, vemerge, vupdateworld" + ewarn "and vdispatch-conf)" + ewarn + ewarn "Additionally the init scripts have changed and now use" + ewarn "upstream scripts as backend. An init script to start" + ewarn "virtual servers in the 'default' group/mark has been" + ewarn "installed by this ebuild:" + ewarn + ewarn " rc-update add vservers.default default" + ewarn + ewarn "To start vservers in other groups/marks, you have to" + ewarn "symlink the default init script the same way you do" + ewarn "with net.* scripts:" + ewarn + ewarn " ln -s /etc/init.d/vservers.default /etc/init.d/vservers.<mark>" + ewarn + fi + + ewarn "You should definitly fix up the barrier of your vserver" + ewarn "base directory by using the following command in a root shell:" + ewarn + ewarn " setattr --barrier ${VDIRBASE}" + ewarn +} |