summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexey D2017-12-20 10:47:30 +0300
committerAlexey D2017-12-20 10:47:30 +0300
commit925d029bc10ed35d7fa4581119eaba5dd1dd4952 (patch)
tree19b758f9af3831901b9abe84027a11fe5378036a
parentd39e8690d3b2ab54bcd64b879a4590789cd124c7 (diff)
downloadaur-925d029bc10ed35d7fa4581119eaba5dd1dd4952.tar.gz
mainstream fix for https://bugs.archlinux.org/task/56681
-rw-r--r--.SRCINFO12
-rw-r--r--PKGBUILD22
-rw-r--r--impossibly-high-memory.patch75
3 files changed, 94 insertions, 15 deletions
diff --git a/.SRCINFO b/.SRCINFO
index aec4e7a9d3f7..419c4261e7b5 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,9 +1,9 @@
# Generated by mksrcinfo v8
-# Fri Jul 15 05:19:46 UTC 2016
+# Wed Dec 20 07:46:40 UTC 2017
pkgbase = procps-ng-nosystemd
pkgdesc = Utilities for monitoring your system and its processes
pkgver = 3.3.12
- pkgrel = 1
+ pkgrel = 2
url = https://gitlab.com/procps-ng/procps
install = procps-ng.install
arch = i686
@@ -24,10 +24,12 @@ pkgbase = procps-ng-nosystemd
replaces = sysvinit-tools
replaces = sysctl-default-conf
backup = etc/sysctl.conf
- source = http://downloads.sourceforge.net/project/procps-ng/Production/procps-ng-3.3.12.tar.xz
+ source = https://downloads.sourceforge.net/project/procps-ng/Production/procps-ng-3.3.12.tar.xz
source = sysctl.conf
- sha1sums = 82c0745f150f1385ca01fe7d24f05f74e31c94c6
- sha1sums = 674282245d8ab2e09017b8f8cdce20a3ff81e631
+ source = impossibly-high-memory.patch
+ sha256sums = 6ed65ab86318f37904e8f9014415a098bec5bc53653e5d9ab404f95ca5e1a7d4
+ sha256sums = bbb659d6e670921312ca205f16e92f47a80d7530160b3277bfc00e5ea0ac3836
+ sha256sums = 1095223d697cf86b7086839666222b853bfa80bb83c7b09eaeceb0c506bea980
pkgname = procps-ng-nosystemd
diff --git a/PKGBUILD b/PKGBUILD
index ec630cfb0787..fe0752a14753 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -4,17 +4,19 @@
pkgname=procps-ng-nosystemd
pkgver=3.3.12
-pkgrel=1
+pkgrel=2
pkgdesc='Utilities for monitoring your system and its processes'
url='https://gitlab.com/procps-ng/procps'
license=('GPL' 'LGPL')
arch=('i686' 'x86_64')
depends=('ncurses')
backup=('etc/sysctl.conf')
-source=("http://downloads.sourceforge.net/project/procps-ng/Production/procps-ng-${pkgver}.tar.xz"
- 'sysctl.conf')
-sha1sums=('82c0745f150f1385ca01fe7d24f05f74e31c94c6'
- '674282245d8ab2e09017b8f8cdce20a3ff81e631')
+source=("https://downloads.sourceforge.net/project/procps-ng/Production/procps-ng-${pkgver}.tar.xz"
+ 'sysctl.conf'
+ 'impossibly-high-memory.patch')
+sha256sums=('6ed65ab86318f37904e8f9014415a098bec5bc53653e5d9ab404f95ca5e1a7d4'
+ 'bbb659d6e670921312ca205f16e92f47a80d7530160b3277bfc00e5ea0ac3836'
+ '1095223d697cf86b7086839666222b853bfa80bb83c7b09eaeceb0c506bea980')
groups=('base')
conflicts=('procps' 'procps-ng' 'sysvinit-tools' 'sysctl-default-conf')
replaces=('procps' 'procps-ng' 'sysvinit-tools' 'sysctl-default-conf')
@@ -24,6 +26,7 @@ install=procps-ng.install
prepare() {
cd "${srcdir}/procps-ng-${pkgver}"
+ patch -p1 -i ../impossibly-high-memory.patch
sed 's:<ncursesw/:<:g' -i watch.c
}
@@ -37,7 +40,10 @@ build() {
--libdir=/usr/lib \
--bindir=/usr/bin \
--sbindir=/usr/bin \
- --enable-watch8bit
+ --enable-watch8bit \
+ --disable-kill
+ # kill is provided by util-linux
+
make
}
@@ -46,8 +52,4 @@ package() {
make DESTDIR="${pkgdir}" install
install -Dm644 "sysctl.conf" "$pkgdir/etc/sysctl.conf"
-
- # provided by util-linux
- rm "${pkgdir}/usr/bin/kill"
- rm "${pkgdir}/usr/share/man/man1/kill.1"
}
diff --git a/impossibly-high-memory.patch b/impossibly-high-memory.patch
new file mode 100644
index 000000000000..2fef7313e95f
--- /dev/null
+++ b/impossibly-high-memory.patch
@@ -0,0 +1,75 @@
+From a2ceb95e2a7d5bf0270f0d342d2edb560f5cfcf4 Mon Sep 17 00:00:00 2001
+From: Jim Warner <james.warner@comcast.net>
+Date: Thu, 17 Aug 2017 01:11:11 -0500
+Subject: [PATCH] top: protect against the anomalous 'Mem' graph display
+
+Until this patch, top falsely assumed that there would
+always be some (small) amount of physical memory after
+subtracting 'used' and 'available' from the total. But
+as the issue referenced below attests, a sum of 'used'
+and 'available' might exceed that total memory amount.
+
+I'm not sure if this is a problem with our calculation
+of the 'used' amount, a flaw in the kernel 'available'
+algorithms or some other reason I cannot even imagine.
+
+Anyway, this patch protects against such a contingency
+through the following single line addition of new code
+. if (pct_used + pct_misc > 100.0 || pct_misc < 0) ...
+
+The check for less than zero is not actually necessary
+as long as the source numbers remain unsigned. However
+should they ever become signed, we'll have protection.
+
+[ Most of the changes in this commit simply separate ]
+[ a variable's definition from its associated logic. ]
+
+Reference(s):
+https://gitlab.com/procps-ng/procps/issues/64
+
+Signed-off-by: Jim Warner <james.warner@comcast.net>
+---
+ top/top.c | 19 ++++++++++++-------
+ 1 files changed, 12 insertions(+), 7 deletions(-)
+
+diff --git a/top/top.c b/top/top.c
+index 385df1d..948805e 100644
+--- a/top/top.c
++++ b/top/top.c
+@@ -5249,21 +5249,26 @@ numa_nope:
+ { "%-.*s~4", "%-.*s~6", "%-.*s~6", Graph_blks }
+ };
+ char used[SMLBUFSIZ], util[SMLBUFSIZ], dual[MEDBUFSIZ];
+- int ix = w->rc.graph_mems - 1;
+- float pct_used = (float)kb_main_used * (100.0 / (float)kb_main_total),
++ float pct_used, pct_misc, pct_swap;
++ int ix, num_used, num_misc;
++
++ pct_used = (float)kb_main_used * (100.0 / (float)kb_main_total);
+ #ifdef MEMGRAPH_OLD
+- pct_misc = (float)(kb_main_buffers + kb_main_cached) * (100.0 / (float)kb_main_total),
++ pct_misc = (float)(kb_main_buffers + kb_main_cached) * (100.0 / (float)kb_main_total);
+ #else
+- pct_misc = (float)(kb_main_total - kb_main_available - kb_main_used) * (100.0 / (float)kb_main_total),
++ pct_misc = (float)(kb_main_total - kb_main_available - kb_main_used) * (100.0 / (float)kb_main_total);
+ #endif
+- pct_swap = kb_swap_total ? (float)kb_swap_used * (100.0 / (float)kb_swap_total) : 0;
++ if (pct_used + pct_misc > 100.0 || pct_misc < 0) pct_misc = 0;
++ pct_swap = kb_swap_total ? (float)kb_swap_used * (100.0 / (float)kb_swap_total) : 0;
++ ix = w->rc.graph_mems - 1;
+ #ifndef QUICK_GRAPHS
+- int num_used = (int)((pct_used * Graph_adj) + .5),
+- num_misc = (int)((pct_misc * Graph_adj) + .5);
++ num_used = (int)((pct_used * Graph_adj) + .5),
++ num_misc = (int)((pct_misc * Graph_adj) + .5);
+ if (num_used + num_misc > Graph_len) --num_misc;
+ snprintf(used, sizeof(used), gtab[ix].used, num_used, gtab[ix].type);
+ snprintf(util, sizeof(util), gtab[ix].misc, num_misc, gtab[ix].type);
+ #else
++ (void)num_used; (void)num_misc;
+ snprintf(used, sizeof(used), gtab[ix].used, (int)((pct_used * Graph_adj) + .5), gtab[ix].type);
+ snprintf(util, sizeof(util), gtab[ix].misc, (int)((pct_misc * Graph_adj) + .4), gtab[ix].type);
+ #endif
+--
+libgit2 0.26.0
+