[arch-commits] Commit in procps-ng/repos (4 files)

2020-05-22 Thread Bartłomiej Piotrowski via arch-commits
Date: Friday, May 22, 2020 @ 12:42:21
  Author: bpiotrowski
Revision: 387422

archrelease: copy trunk to testing-x86_64

Added:
  procps-ng/repos/testing-x86_64/
  procps-ng/repos/testing-x86_64/PKGBUILD
(from rev 387421, procps-ng/trunk/PKGBUILD)
  procps-ng/repos/testing-x86_64/fs66093.patch
(from rev 387421, procps-ng/trunk/fs66093.patch)
  procps-ng/repos/testing-x86_64/install
(from rev 387421, procps-ng/trunk/install)

---+
 PKGBUILD  |   52 
 fs66093.patch |   60 
 install   |   14 +
 3 files changed, 126 insertions(+)

Copied: procps-ng/repos/testing-x86_64/PKGBUILD (from rev 387421, 
procps-ng/trunk/PKGBUILD)
===
--- testing-x86_64/PKGBUILD (rev 0)
+++ testing-x86_64/PKGBUILD 2020-05-22 12:42:21 UTC (rev 387422)
@@ -0,0 +1,52 @@
+# Maintainer:  Bartłomiej Piotrowski 
+# Contributor: Gaetan Bisson 
+# Contributor: Eric Bélanger 
+
+pkgname=procps-ng
+pkgver=3.3.16
+pkgrel=2
+pkgdesc='Utilities for monitoring your system and its processes'
+url='https://gitlab.com/procps-ng/procps'
+license=(GPL LGPL)
+arch=(x86_64)
+depends=(ncurses systemd-libs)
+makedepends=(systemd)
+conflicts=(procps sysvinit-tools)
+provides=(procps sysvinit-tools)
+replaces=(procps sysvinit-tools)
+install=install
+source=(https://downloads.sourceforge.net/project/$pkgname/Production/${pkgname}-${pkgver}.tar.xz
+fs66093.patch)
+sha256sums=('925eacd65dedcf9c98eb94e8978bbfb63f5de37294cc1047d81462ed477a20af'
+'48eb1f6e1b84d9dfec27556771c05f6a02880aefbe774a3db71bee0c35228992')
+
+prepare() {
+  cd $pkgname-$pkgver
+  sed 's:https://bugs.archlinux.org/task/66093
+  patch -p1 -i ../fs66093.patch
+}
+
+build() {
+  cd $pkgname-$pkgver
+  ./configure \
+--prefix=/usr \
+--exec-prefix=/ \
+--sysconfdir=/etc \
+--libdir=/usr/lib \
+--bindir=/usr/bin \
+--sbindir=/usr/bin \
+--enable-watch8bit \
+--with-systemd \
+--disable-modern-top \
+--disable-kill
+
+  make
+}
+
+package() {
+  cd $pkgname-$pkgver
+  make DESTDIR="$pkgdir" install
+}

Copied: procps-ng/repos/testing-x86_64/fs66093.patch (from rev 387421, 
procps-ng/trunk/fs66093.patch)
===
--- testing-x86_64/fs66093.patch(rev 0)
+++ testing-x86_64/fs66093.patch2020-05-22 12:42:21 UTC (rev 387422)
@@ -0,0 +1,60 @@
+From bb96fc42956c9ed926a1b958ab715f8b4a663dec Mon Sep 17 00:00:00 2001
+From: Craig Small 
+Date: Sun, 5 Jan 2020 15:05:55 +1100
+Subject: [PATCH] pgrep: check sanity of SC_ARG_MAX
+
+A kernel change means we cannot trust what sysconf(SC_ARG_MAX)
+returns. We clamp it so its more than 4096 and less than 128*1024
+which is what findutils does.
+
+References:
+ procps-ng/procps#152
+ https://git.savannah.gnu.org/cgit/findutils.git/tree/lib/buildcmd.c#n535
+ https://lwn.net/Articles/727862/
+---
+ pgrep.c | 22 +-
+ 1 file changed, 21 insertions(+), 1 deletion(-)
+
+diff --git a/pgrep.c b/pgrep.c
+index 01563db..bde7448 100644
+--- a/pgrep.c
 b/pgrep.c
+@@ -485,6 +485,26 @@ static regex_t * do_regcomp (void)
+   return preg;
+ }
+ 
++/*
++ * SC_ARG_MAX used to return the maximum size a command line can be
++ * however changes to the kernel mean this can be bigger than we can
++ * alloc. Clamp it to 128kB like xargs and friends do
++ * Should also not be smaller than POSIX_ARG_MAX which is 4096
++ */
++static size_t get_arg_max(void)
++{
++#define MIN_ARG_SIZE 4096u
++#define MAX_ARG_SIZE (128u * 1024u)
++
++size_t val = sysconf(_SC_ARG_MAX);
++
++if (val < MIN_ARG_SIZE)
++  val = MIN_ARG_SIZE;
++if (val > MAX_ARG_SIZE)
++  val = MAX_ARG_SIZE;
++
++return val;
++}
+ static struct el * select_procs (int *num)
+ {
+   PROCTAB *ptp;
+@@ -497,7 +517,7 @@ static struct el * select_procs (int *num)
+   regex_t *preg;
+   pid_t myself = getpid();
+   struct el *list = NULL;
+-long cmdlen = sysconf(_SC_ARG_MAX) * sizeof(char);
++long cmdlen = get_arg_max() * sizeof(char);
+   char *cmdline = xmalloc(cmdlen);
+   char *cmdsearch = xmalloc(cmdlen);
+   char *cmdoutput = xmalloc(cmdlen);
+-- 
+2.26.2
+

Copied: procps-ng/repos/testing-x86_64/install (from rev 387421, 
procps-ng/trunk/install)
===
--- testing-x86_64/install  (rev 0)
+++ testing-x86_64/install  2020-05-22 12:42:21 UTC (rev 387422)
@@ -0,0 +1,14 @@
+post_upgrade() {
+   if [[ $(vercmp $2 3.3.8-3) = -1 ]]; then
+   cat < The file /etc/sysctl.conf has been removed from this
+==> package, as all its settings are now kernel defaults.
+
+==> If you had customized it, you need to rename it as
+==> 

[arch-commits] Commit in procps-ng/repos (4 files)

2018-02-12 Thread Bartłomiej Piotrowski via arch-commits
Date: Monday, February 12, 2018 @ 23:22:00
  Author: bpiotrowski
Revision: 316737

archrelease: copy trunk to testing-x86_64

Added:
  procps-ng/repos/testing-x86_64/
  procps-ng/repos/testing-x86_64/PKGBUILD
(from rev 316736, procps-ng/trunk/PKGBUILD)
  procps-ng/repos/testing-x86_64/impossibly-high-memory.patch
(from rev 316736, procps-ng/trunk/impossibly-high-memory.patch)
  procps-ng/repos/testing-x86_64/install
(from rev 316736, procps-ng/trunk/install)

--+
 PKGBUILD |   55 ++
 impossibly-high-memory.patch |   75 +
 install  |   14 +++
 3 files changed, 144 insertions(+)

Copied: procps-ng/repos/testing-x86_64/PKGBUILD (from rev 316736, 
procps-ng/trunk/PKGBUILD)
===
--- testing-x86_64/PKGBUILD (rev 0)
+++ testing-x86_64/PKGBUILD 2018-02-12 23:22:00 UTC (rev 316737)
@@ -0,0 +1,55 @@
+# $Id$
+# Maintainer: Gaetan Bisson 
+# Contributor: Eric Bélanger 
+
+pkgname=procps-ng
+pkgver=3.3.12
+pkgrel=3
+pkgdesc='Utilities for monitoring your system and its processes'
+url='https://gitlab.com/procps-ng/procps'
+license=('GPL' 'LGPL')
+arch=('x86_64')
+makedepends=('systemd')
+depends=('ncurses' 'libsystemd')
+source=("https://downloads.sourceforge.net/project/${pkgname}/Production/${pkgname}-${pkgver}.tar.xz;
+'impossibly-high-memory.patch')
+sha256sums=('6ed65ab86318f37904e8f9014415a098bec5bc53653e5d9ab404f95ca5e1a7d4'
+'1095223d697cf86b7086839666222b853bfa80bb83c7b09eaeceb0c506bea980')
+
+groups=('base')
+
+conflicts=('procps' 'sysvinit-tools')
+provides=('procps' 'sysvinit-tools')
+replaces=('procps' 'sysvinit-tools')
+
+install=install
+
+prepare() {
+   cd "${srcdir}/${pkgname}-${pkgver}"
+   patch -p1 -i ../impossibly-high-memory.patch
+   sed 's:
+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 
+---
+ 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, 

[arch-commits] Commit in procps-ng/repos (4 files)

2017-12-15 Thread Gaëtan Bisson via arch-commits
Date: Friday, December 15, 2017 @ 20:42:36
  Author: bisson
Revision: 312934

archrelease: copy trunk to testing-x86_64

Added:
  procps-ng/repos/testing-x86_64/
  procps-ng/repos/testing-x86_64/PKGBUILD
(from rev 312933, procps-ng/trunk/PKGBUILD)
  procps-ng/repos/testing-x86_64/impossibly-high-memory.patch
(from rev 312933, procps-ng/trunk/impossibly-high-memory.patch)
  procps-ng/repos/testing-x86_64/install
(from rev 312933, procps-ng/trunk/install)

--+
 PKGBUILD |   54 +
 impossibly-high-memory.patch |   75 +
 install  |   14 +++
 3 files changed, 143 insertions(+)

Copied: procps-ng/repos/testing-x86_64/PKGBUILD (from rev 312933, 
procps-ng/trunk/PKGBUILD)
===
--- testing-x86_64/PKGBUILD (rev 0)
+++ testing-x86_64/PKGBUILD 2017-12-15 20:42:36 UTC (rev 312934)
@@ -0,0 +1,54 @@
+# $Id$
+# Maintainer: Gaetan Bisson 
+# Contributor: Eric Bélanger 
+
+pkgname=procps-ng
+pkgver=3.3.12
+pkgrel=2
+pkgdesc='Utilities for monitoring your system and its processes'
+url='https://gitlab.com/procps-ng/procps'
+license=('GPL' 'LGPL')
+arch=('x86_64')
+makedepends=('systemd')
+depends=('ncurses' 'libsystemd')
+source=("https://downloads.sourceforge.net/project/${pkgname}/Production/${pkgname}-${pkgver}.tar.xz;
+'impossibly-high-memory.patch')
+sha256sums=('6ed65ab86318f37904e8f9014415a098bec5bc53653e5d9ab404f95ca5e1a7d4'
+'1095223d697cf86b7086839666222b853bfa80bb83c7b09eaeceb0c506bea980')
+
+groups=('base')
+
+conflicts=('procps' 'sysvinit-tools')
+provides=('procps' 'sysvinit-tools')
+replaces=('procps' 'sysvinit-tools')
+
+install=install
+
+prepare() {
+   cd "${srcdir}/${pkgname}-${pkgver}"
+   patch -p1 -i ../impossibly-high-memory.patch
+   sed 's:
+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 
+---
+ 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);