From 8c7ec0bed7b5dcf6a792b6e56802e2d5347cb9b7 Mon Sep 17 00:00:00 2001 From: ians Date: Thu, 26 Jul 2018 11:34:27 +0000 Subject: [PATCH] Fix bugs affecting 8-core machines zero-index involving NCPU sysctl being used as loop condition fixed early free fixed --- sysutils/htop/Makefile | 4 ++-- sysutils/htop/patches/patch-CPUMeter_c | 15 +++++++++++++++ sysutils/htop/patches/patch-Vector_c | 16 ++++++++++++++++ sysutils/htop/patches/patch-openbsd_Platform_c | 10 ++-------- 4 files changed, 35 insertions(+), 10 deletions(-) create mode 100644 sysutils/htop/patches/patch-CPUMeter_c create mode 100644 sysutils/htop/patches/patch-Vector_c diff --git a/sysutils/htop/Makefile b/sysutils/htop/Makefile index b7a565e79f9..35685035b4c 100644 --- a/sysutils/htop/Makefile +++ b/sysutils/htop/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.9 2018/07/17 14:14:37 ians Exp $ +# $OpenBSD: Makefile,v 1.10 2018/07/26 11:34:27 ians Exp $ COMMENT = interactive process viewer V = 2.2.0 @@ -6,7 +6,7 @@ DISTNAME = htop-${V} CATEGORIES = sysutils HOMEPAGE = https://hisham.hm/htop/index.php MAINTAINER = Ian Sutton -REVISION = 4 +REVISION = 5 # GPLv2+ PERMIT_PACKAGE_CDROM = Yes diff --git a/sysutils/htop/patches/patch-CPUMeter_c b/sysutils/htop/patches/patch-CPUMeter_c new file mode 100644 index 00000000000..619d1c930d4 --- /dev/null +++ b/sysutils/htop/patches/patch-CPUMeter_c @@ -0,0 +1,15 @@ +$OpenBSD: patch-CPUMeter_c,v 1.1 2018/07/26 11:34:27 ians Exp $ + +Index: CPUMeter.c +--- CPUMeter.c.orig ++++ CPUMeter.c +@@ -135,6 +135,9 @@ static void AllCPUsMeter_getRange(Meter* this, int* st + *count = cpus / 2; + break; + } ++ ++ if (*count == cpus) ++ *count = *count - 1; + } + + static void AllCPUsMeter_init(Meter* this) { diff --git a/sysutils/htop/patches/patch-Vector_c b/sysutils/htop/patches/patch-Vector_c new file mode 100644 index 00000000000..3e25594c4b4 --- /dev/null +++ b/sysutils/htop/patches/patch-Vector_c @@ -0,0 +1,16 @@ +$OpenBSD: patch-Vector_c,v 1.1 2018/07/26 11:34:27 ians Exp $ + +Index: Vector.c +--- Vector.c.orig ++++ Vector.c +@@ -53,8 +53,8 @@ void Vector_delete(Vector* this) { + if (this->array[i]) + Object_delete(this->array[i]); + } +- free(this->array); +- free(this); ++ /* free(this->array); ++ free(this); */ + } + + #ifdef DEBUG diff --git a/sysutils/htop/patches/patch-openbsd_Platform_c b/sysutils/htop/patches/patch-openbsd_Platform_c index f6de20b2915..4d0a866e157 100644 --- a/sysutils/htop/patches/patch-openbsd_Platform_c +++ b/sysutils/htop/patches/patch-openbsd_Platform_c @@ -1,4 +1,4 @@ -$OpenBSD: patch-openbsd_Platform_c,v 1.2 2018/07/17 14:14:37 ians Exp $ +$OpenBSD: patch-openbsd_Platform_c,v 1.3 2018/07/26 11:34:27 ians Exp $ Index: openbsd/Platform.c --- openbsd/Platform.c.orig @@ -12,13 +12,7 @@ Index: openbsd/Platform.c /* * Copyright (c) 1984, 1989, William LeFebvre, Rice University -@@ -220,12 +220,12 @@ double Platform_setCPUValues(Meter* this, int cpu) { - percentages(CPUSTATES, diff_v, new_v, - (int64_t *)old_v[cpu-1], scratch_v); - -- for (i = 0; i < CPUSTATES; i++) { -+ for (i = 0; i < CPUSTATES - 1; i++) { - old_v[cpu-1][i] = new_v[i]; +@@ -225,7 +225,7 @@ double Platform_setCPUValues(Meter* this, int cpu) { v[i] = diff_v[i] / 10.; }