summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Marples <uberlord@gentoo.org>2007-07-07 19:48:14 +0000
committerRoy Marples <uberlord@gentoo.org>2007-07-07 19:48:14 +0000
commitbf51445e44678e2d0893855644da610d136ae62c (patch)
tree8d2fa5bced4bd095645b10055f5880e2e11df418
parentStable on ppc; bug #184462. (diff)
downloadgentoo-2-bf51445e44678e2d0893855644da610d136ae62c.tar.gz
gentoo-2-bf51445e44678e2d0893855644da610d136ae62c.tar.bz2
gentoo-2-bf51445e44678e2d0893855644da610d136ae62c.zip
Close stdin, stdout and stderr after forking, #182721.
(Portage version: 2.1.3_rc6)
-rw-r--r--sys-libs/gpm/ChangeLog10
-rw-r--r--sys-libs/gpm/files/digest-gpm-1.20.1-r66
-rw-r--r--sys-libs/gpm/files/gpm-daemon.patch48
-rw-r--r--sys-libs/gpm/gpm-1.20.1-r6.ebuild75
4 files changed, 137 insertions, 2 deletions
diff --git a/sys-libs/gpm/ChangeLog b/sys-libs/gpm/ChangeLog
index 0ae3fe790ab6..ceb559de995e 100644
--- a/sys-libs/gpm/ChangeLog
+++ b/sys-libs/gpm/ChangeLog
@@ -1,6 +1,12 @@
# ChangeLog for sys-libs/gpm
-# Copyright 1999-2006 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-libs/gpm/ChangeLog,v 1.55 2006/09/05 03:44:50 kumba Exp $
+# Copyright 1999-2007 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/sys-libs/gpm/ChangeLog,v 1.56 2007/07/07 19:48:14 uberlord Exp $
+
+*gpm-1.20.1-r6 (07 Jul 2007)
+
+ 07 Jul 2007; Roy Marples <uberlord@gentoo.org> +files/gpm-daemon.patch,
+ +gpm-1.20.1-r6.ebuild:
+ Close stdin, stdout and stderr after forking, #182721.
05 Sep 2006; Joshua Kinard <kumba@gentoo.org> gpm-1.20.1-r5.ebuild:
Marked stable on mips.
diff --git a/sys-libs/gpm/files/digest-gpm-1.20.1-r6 b/sys-libs/gpm/files/digest-gpm-1.20.1-r6
new file mode 100644
index 000000000000..0083e96a72bb
--- /dev/null
+++ b/sys-libs/gpm/files/digest-gpm-1.20.1-r6
@@ -0,0 +1,6 @@
+MD5 ede95b6eb848f87440a2d7f86eaaf13a gpm-1.20.1-patches-1.4.tar.bz2 8049
+RMD160 9bf31260db39870a678ed1167c0b242a778b2b61 gpm-1.20.1-patches-1.4.tar.bz2 8049
+SHA256 64d68412c95358f7d3a525dce38661aa53f13c0ddf2e20eb869325e8dd170e07 gpm-1.20.1-patches-1.4.tar.bz2 8049
+MD5 2c63e827d755527950d9d13fe3d87692 gpm-1.20.1.tar.bz2 565014
+RMD160 2650ae1e3e87fcf8bdad80acf62777e8a62b6582 gpm-1.20.1.tar.bz2 565014
+SHA256 11fabe7f27a205ff1ea6aee23e1dc2bb2dc5dbfc45ff0320fca0cd559806a936 gpm-1.20.1.tar.bz2 565014
diff --git a/sys-libs/gpm/files/gpm-daemon.patch b/sys-libs/gpm/files/gpm-daemon.patch
new file mode 100644
index 000000000000..75bbb9945c49
--- /dev/null
+++ b/sys-libs/gpm/files/gpm-daemon.patch
@@ -0,0 +1,48 @@
+Daemons should always close stdin, stdout and stderr after forking otherwise
+the controlling terminal will have issues closing.
+Examples include starting over ssh or baselayout-2
+http://bugs.gentoo.org/show_bug.cgi?id=182721
+
+diff -ur a/src/startup.c b/src/startup.c
+--- a/src/startup.c 2002-12-24 22:57:16.000000000 +0000
++++ b/src/startup.c 2007-07-06 23:33:50.000000000 +0100
+@@ -29,7 +29,7 @@
+ #include <sys/types.h> /* geteuid, mknod */
+ #include <sys/stat.h> /* mknod */
+ #include <fcntl.h> /* mknod */
+-#include <unistd.h> /* mknod */
++#include <unistd.h> /* mknod, daemon */
+
+
+ #include "headers/gpmInt.h"
+@@ -134,26 +134,17 @@
+ }
+ }
+
+- if(option.run_status == GPM_RUN_STARTUP ) { /* else is debugging */
+- /* goto background and become a session leader (Stefan Giessler) */
+- switch(fork()) {
+- case -1: gpm_report(GPM_PR_OOPS,GPM_MESS_FORK_FAILED); /* error */
+- case 0: option.run_status = GPM_RUN_DAEMON; break; /* child */
+- default: _exit(0); /* parent */
+- }
++ if (option.run_status == GPM_RUN_STARTUP ) { /* else is debugging */
++ if (daemon(0,0))
++ gpm_report(GPM_PR_OOPS,GPM_MESS_FORK_FAILED); /* error */
+
+- if (setsid() < 0) gpm_report(GPM_PR_OOPS,GPM_MESS_SETSID_FAILED);
++ option.run_status = GPM_RUN_DAEMON; /* child */
+ }
+
+ /* damon init: check whether we run or not, display message */
+ check_uniqueness();
+ gpm_report(GPM_PR_INFO,GPM_MESS_STARTED);
+
+- /* is changing to root needed, because of relative paths ? or can we just
+- * remove and ignore it ?? FIXME */
+- if (chdir("/") < 0) gpm_report(GPM_PR_OOPS,GPM_MESS_CHDIR_FAILED);
+-
+-
+ //return mouse_table[1].fd; /* the second is handled in the main() */
+
+ /****************** OLD CODE from gpn.c END ***********************/
diff --git a/sys-libs/gpm/gpm-1.20.1-r6.ebuild b/sys-libs/gpm/gpm-1.20.1-r6.ebuild
new file mode 100644
index 000000000000..db71761253d7
--- /dev/null
+++ b/sys-libs/gpm/gpm-1.20.1-r6.ebuild
@@ -0,0 +1,75 @@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-libs/gpm/gpm-1.20.1-r6.ebuild,v 1.1 2007/07/07 19:48:14 uberlord Exp $
+
+# emacs support disabled due to Bug 99533
+
+inherit eutils toolchain-funcs
+#elisp-common
+
+PATCH_VER="1.4"
+DESCRIPTION="Console-based mouse driver"
+HOMEPAGE="http://linux.schottelius.org/gpm/"
+SRC_URI="ftp://arcana.linux.it/pub/gpm/${P}.tar.bz2
+ ftp://ftp.schottelius.org/pub/linux/gpm/${P}.tar.bz2
+ mirror://gentoo/${P}-patches-${PATCH_VER}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+IUSE="selinux" # emacs"
+
+DEPEND="sys-libs/ncurses"
+# emacs? ( virtual/emacs )"
+RDEPEND="selinux? ( sec-policy/selinux-gpm )"
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ EPATCH_SUFFIX="patch" epatch "${WORKDIR}"/patch
+ epatch "${FILESDIR}"/gpm-configure-LANG.patch
+ epatch "${FILESDIR}"/gpm-daemon.patch
+}
+
+src_compile() {
+ econf \
+ --libdir=/$(get_libdir) \
+ --sysconfdir=/etc/gpm \
+ || die "econf failed"
+ emake \
+ CC=$(tc-getCC) \
+ AR=$(tc-getAR) \
+ RANLIB=$(tc-getRANLIB) \
+ EMACS=: \
+ || die "emake failed"
+
+# local lisp="emacs/t-mouse.el emacs/t-mouse.elc"
+# if use emacs ; then
+# cd "${S}"/contrib ; make clean
+# make EMACS=emacs ELISP="${lisp}" || die
+# fi
+}
+
+src_install() {
+ make install DESTDIR="${D}" EMACS=: ELISP="" || die "make install failed"
+ # fix lib symlinks since the default is missing/bogus
+ dosym libgpm.so.1.19.0 /$(get_libdir)/libgpm.so.1
+ dosym libgpm.so.1 /$(get_libdir)/libgpm.so
+ dodir /usr/$(get_libdir)
+ mv "${D}"/$(get_libdir)/*.a "${D}"/usr/$(get_libdir)/
+ gen_usr_ldscript libgpm.so
+
+# if use emacs ; then
+# cd "${S}"/contrib/emacs
+# elisp-install . t-mouse*
+# fi
+
+ insinto /etc/gpm
+ doins conf/gpm-*.conf
+
+ dodoc BUGS Changes README TODO
+ dodoc doc/Announce doc/FAQ doc/README*
+
+ newinitd "${FILESDIR}"/gpm.rc6 gpm
+ newconfd "${FILESDIR}"/gpm.conf.d gpm
+}