summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason A. Donenfeld <zx2c4@gentoo.org>2016-02-16 15:36:41 +0100
committerJason A. Donenfeld <zx2c4@gentoo.org>2016-02-16 15:37:57 +0100
commitdfb0fda447041b8658d13919e348a04f56cf1073 (patch)
treedd47abf9314f8aa589019aabbd79b2684f29a8b5 /sys-process
parentvirtual/jack: new ebuild (diff)
downloadgentoo-dfb0fda447041b8658d13919e348a04f56cf1073.tar.gz
gentoo-dfb0fda447041b8658d13919e348a04f56cf1073.tar.bz2
gentoo-dfb0fda447041b8658d13919e348a04f56cf1073.zip
sys-process/htop: do not crash on startup
Certain htoprc files trigger a crash at startup. Upstream's instruction is to include this commit until a new version is released.
Diffstat (limited to 'sys-process')
-rw-r--r--sys-process/htop/files/htop-2.0.0-commlen.patch22
-rw-r--r--sys-process/htop/htop-2.0.0-r1.ebuild76
2 files changed, 98 insertions, 0 deletions
diff --git a/sys-process/htop/files/htop-2.0.0-commlen.patch b/sys-process/htop/files/htop-2.0.0-commlen.patch
new file mode 100644
index 000000000000..f44e43ebbeb2
--- /dev/null
+++ b/sys-process/htop/files/htop-2.0.0-commlen.patch
@@ -0,0 +1,22 @@
+From 0b70439316b4e4608c0916317ded7e6e56982de6 Mon Sep 17 00:00:00 2001
+From: Hisham <hisham@gobolinux.org>
+Date: Sat, 13 Feb 2016 02:18:28 -0200
+Subject: [PATCH] Fix buffer reuse.
+
+---
+ linux/LinuxProcessList.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/linux/LinuxProcessList.c b/linux/LinuxProcessList.c
+index 591210e..ec643ab 100644
+--- a/linux/LinuxProcessList.c
++++ b/linux/LinuxProcessList.c
+@@ -446,7 +446,7 @@ static void LinuxProcessList_readOomData(LinuxProcess* process, const char* dirn
+ }
+
+ static void setCommand(Process* process, const char* command, int len) {
+- if (process->comm && process->commLen <= len) {
++ if (process->comm && process->commLen >= len) {
+ strncpy(process->comm, command, len + 1);
+ } else {
+ free(process->comm);
diff --git a/sys-process/htop/htop-2.0.0-r1.ebuild b/sys-process/htop/htop-2.0.0-r1.ebuild
new file mode 100644
index 000000000000..f7224ea0f5e1
--- /dev/null
+++ b/sys-process/htop/htop-2.0.0-r1.ebuild
@@ -0,0 +1,76 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+
+inherit autotools linux-info
+
+DESCRIPTION="interactive process viewer"
+HOMEPAGE="http://hisham.hm/htop/"
+SRC_URI="http://hisham.hm/htop/releases/${PV}/${P}.tar.gz"
+
+LICENSE="BSD GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc ~x86 ~amd64-linux ~x86-linux"
+IUSE="kernel_FreeBSD kernel_linux openvz unicode vserver"
+
+RDEPEND="sys-libs/ncurses:0=[unicode?]"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig"
+
+DOCS=( ChangeLog README )
+
+CONFIG_CHECK="~TASKSTATS ~TASK_XACCT ~TASK_IO_ACCOUNTING ~CGROUPS"
+
+PATCHES=(
+ "${FILESDIR}/${PN}-2.0.0-tinfo.patch"
+ "${FILESDIR}/${P}-commlen.patch"
+)
+
+pkg_setup() {
+ if use kernel_FreeBSD && ! [[ -f ${ROOT}/compat/linux/proc/stat && -f ${ROOT}/compat/linux/proc/meminfo ]]; then
+ echo
+ eerror "htop requires linprocfs mounted at /compat/linux/proc to build and function."
+ eerror "To mount it, type:"
+ [ -d /compat/linux/proc ] || eerror "mkdir -p /compat/linux/proc"
+ eerror "mount -t linprocfs none /compat/linux/proc"
+ eerror "Alternatively, place this information into /etc/fstab"
+ echo
+ die "htop needs /compat/linux/proc mounted"
+ fi
+
+ if ! has_version sys-process/lsof; then
+ ewarn "To use lsof features in htop(what processes are accessing"
+ ewarn "what files), you must have sys-process/lsof installed."
+ fi
+
+ linux-info_pkg_setup
+}
+
+src_prepare() {
+ rm missing || die
+
+ default
+ eautoreconf
+}
+
+src_configure() {
+ [[ $CBUILD != $CHOST ]] && export ac_cv_file__proc_{meminfo,stat}=yes #328971
+
+ local myeconfargs=()
+
+ use kernel_FreeBSD && myeconfargs+=( --with-proc=/compat/linux/proc )
+
+ myeconfargs+=(
+ # fails to build against recent hwloc versions
+ --disable-hwloc
+ --enable-native-affinity
+ --enable-taskstats
+ $(use_enable kernel_linux cgroup)
+ $(use_enable openvz)
+ $(use_enable unicode)
+ $(use_enable vserver)
+ )
+ econf ${myeconfargs[@]}
+}