commit:     f04018ad352989d27434700fecc8108a917f2ff5
Author:     Marty E. Plummer <hanetzer <AT> startmail <DOT> com>
AuthorDate: Fri Apr 20 16:04:58 2018 +0000
Commit:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
CommitDate: Mon Apr 23 14:53:17 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f04018ad

sys-process/unixtop: epatch->PATCHES=()

Reworked patches to be -p1, and converted the two 'diff -c' context
style diffs to a 'diff -u' unified diff, both for greater readability
and a generally smaller filesize.

Package-Manager: Portage-2.3.31, Repoman-2.3.9

 .../unixtop-3.8_beta1-high-threadid-crash.patch    | 115 +++++++--------------
 .../files/unixtop-3.8_beta1-memleak-fix-v2.patch   |  68 +++++-------
 .../unixtop/files/unixtop-3.8_beta1-ncurses.patch  |   4 +-
 .../files/unixtop-3.8_beta1-no-AX-macros.patch     |   4 +-
 sys-process/unixtop/unixtop-3.8_beta1-r3.ebuild    |  21 ++--
 5 files changed, 82 insertions(+), 130 deletions(-)

diff --git 
a/sys-process/unixtop/files/unixtop-3.8_beta1-high-threadid-crash.patch 
b/sys-process/unixtop/files/unixtop-3.8_beta1-high-threadid-crash.patch
index 734826a647d..00f19536e38 100644
--- a/sys-process/unixtop/files/unixtop-3.8_beta1-high-threadid-crash.patch
+++ b/sys-process/unixtop/files/unixtop-3.8_beta1-high-threadid-crash.patch
@@ -1,75 +1,40 @@
-https://sourceforge.net/tracker/index.php?func=detail&aid=2815842&group_id=72892&atid=536042
-
-*** hash.c-old  Thu Jul  2 15:30:55 2009
---- hash.c      Thu Jul  2 15:48:39 2009
-***************
-*** 1354,1360 ****
-      hi->value = value;
-
-      /* hash to the bucket */
-!     bucket = &(ht->buckets[((key.k_thr * 10000 + key.k_pid) % 
ht->num_buckets)]);
-
-      /* walk the list to make sure we do not have a duplicate */
-      ll = &(bucket->list);
---- 1354,1360 ----
-      hi->value = value;
-
-      /* hash to the bucket */
-!     bucket = &(ht->buckets[(((unsigned long)(key.k_thr) * 10000U + (unsigned 
long)(key.k_pid)) % ht->num_buckets)]);
-
-      /* walk the list to make sure we do not have a duplicate */
-      ll = &(bucket->list);
-***************
-*** 1408,1414 ****
-      pidthr_t k1;
-
-      /* find the bucket */
-!     bucket = &(ht->buckets[((key.k_thr * 10000 + key.k_pid) % 
ht->num_buckets)]);
-
-      /* walk the list until we find the existing item */
-      ll = &(bucket->list);
---- 1408,1414 ----
-      pidthr_t k1;
-
-      /* find the bucket */
-!     bucket = &(ht->buckets[(((unsigned long)(key.k_thr) * 10000U + (unsigned 
long)(key.k_pid)) % ht->num_buckets)]);
-
-      /* walk the list until we find the existing item */
-      ll = &(bucket->list);
-***************
-*** 1460,1466 ****
-      pidthr_t k1;
-
-      result = NULL;
-!     if ((bucket = &(ht->buckets[((key.k_thr * 10000 + key.k_pid) % 
ht->num_buckets)])) != NULL)
-      {
-        ll = &(bucket->list);
-        li = LL_FIRST(ll);
---- 1460,1466 ----
-      pidthr_t k1;
-
-      result = NULL;
-!     if ((bucket = &(ht->buckets[(((unsigned long)(key.k_thr) * 10000U + 
(unsigned long)(key.k_pid)) % ht->num_buckets)])) != NULL)
-      {
-        ll = &(bucket->list);
-        li = LL_FIRST(ll);
-***************
-*** 1499,1505 ****
-      pidthr_t k1;
-
-      result = NULL;
-!     if ((bucket = &(ht->buckets[((key.k_thr * 10000 + key.k_pid) % 
ht->num_buckets)])) != NULL)
-      {
-        ll = &(bucket->list);
-        li = LL_FIRST(ll);
---- 1499,1505 ----
-      pidthr_t k1;
-
-      result = NULL;
-!     if ((bucket = &(ht->buckets[(((unsigned long)(key.k_thr) * 10000U + 
(unsigned long)(key.k_pid)) % ht->num_buckets)])) != NULL)
-      {
-        ll = &(bucket->list);
-        li = LL_FIRST(ll);
-
-
-
+https://sourceforge.net/p/unixtop/bugs/43/
+
+--- a/hash.c
++++ b/hash.c
+@@ -1354,7 +1354,7 @@ hash_add_pidthr(hash_table *ht, pidthr_t
+     hi->value = value;
+ 
+     /* hash to the bucket */
+-    bucket = &(ht->buckets[((key.k_thr * 10000 + key.k_pid) % 
ht->num_buckets)]);
++    bucket = &(ht->buckets[(((unsigned long)(key.k_thr) * 10000U + (unsigned 
long)(key.k_pid)) % ht->num_buckets)]);
+ 
+     /* walk the list to make sure we do not have a duplicate */
+     ll = &(bucket->list);
+@@ -1408,7 +1408,7 @@ hash_replace_pidthr(hash_table *ht, pidt
+     pidthr_t k1;
+ 
+     /* find the bucket */
+-    bucket = &(ht->buckets[((key.k_thr * 10000 + key.k_pid) % 
ht->num_buckets)]);
++    bucket = &(ht->buckets[(((unsigned long)(key.k_thr) * 10000U + (unsigned 
long)(key.k_pid)) % ht->num_buckets)]);
+ 
+     /* walk the list until we find the existing item */
+     ll = &(bucket->list);
+@@ -1460,7 +1460,7 @@ hash_lookup_pidthr(hash_table *ht, pidth
+     pidthr_t k1;
+ 
+     result = NULL;
+-    if ((bucket = &(ht->buckets[((key.k_thr * 10000 + key.k_pid) % 
ht->num_buckets)])) != NULL)
++    if ((bucket = &(ht->buckets[(((unsigned long)(key.k_thr) * 10000U + 
(unsigned long)(key.k_pid)) % ht->num_buckets)])) != NULL)
+     {
+       ll = &(bucket->list);
+       li = LL_FIRST(ll);
+@@ -1499,7 +1499,7 @@ hash_remove_pidthr(hash_table *ht, pidth
+     pidthr_t k1;
+ 
+     result = NULL;
+-    if ((bucket = &(ht->buckets[((key.k_thr * 10000 + key.k_pid) % 
ht->num_buckets)])) != NULL)
++    if ((bucket = &(ht->buckets[(((unsigned long)(key.k_thr) * 10000U + 
(unsigned long)(key.k_pid)) % ht->num_buckets)])) != NULL)
+     {
+       ll = &(bucket->list);
+       li = LL_FIRST(ll);

diff --git a/sys-process/unixtop/files/unixtop-3.8_beta1-memleak-fix-v2.patch 
b/sys-process/unixtop/files/unixtop-3.8_beta1-memleak-fix-v2.patch
index 76042bb4c1a..2d79c7293f9 100644
--- a/sys-process/unixtop/files/unixtop-3.8_beta1-memleak-fix-v2.patch
+++ b/sys-process/unixtop/files/unixtop-3.8_beta1-memleak-fix-v2.patch
@@ -1,44 +1,28 @@
 
https://hg.openindiana.org/upstream/oracle/userland-gate/raw-file/23c55a2f8a8e/components/top/patches/03.sunos5.patch
 
-*** top-3.8beta1/machine/m_sunos5.c.orig       Wed Aug 31 05:23:52 2011
---- top-3.8beta1/machine/m_sunos5.c    Wed Aug 31 05:25:25 2011
-***************
-*** 2064,2070 ****
-  
-           /* read the whole file */
-           p = malloc(st.st_size);
-!          (void)pread(fd, p, st.st_size, 0);
-  
-           /* cache the file descriptor if we can */
-           if (fd < maxfiles)
---- 2064,2076 ----
-  
-           /* read the whole file */
-           p = malloc(st.st_size);
-!          if (pread(fd, p, st.st_size, 0) != st.st_size)
-!          {
-!              (void) close(fd);
-!              op->fd_lpsinfo = -1;
-!              free(p);
-!              continue;
-!          }
-  
-           /* cache the file descriptor if we can */
-           if (fd < maxfiles)
-***************
-*** 2148,2154 ****
-               op->oldtime = TIMESPEC_TO_DOUBLE(lwpp->pr_time);
-               op->seen = 1;
-           }
-!          free(p);
-       }
-  #endif
-  
---- 2154,2160 ----
-               op->oldtime = TIMESPEC_TO_DOUBLE(lwpp->pr_time);
-               op->seen = 1;
-           }
-!          free(prp);
-       }
-  #endif
-  
+--- a/machine/m_sunos5.c
++++ b/machine/m_sunos5.c
+@@ -2064,7 +2064,13 @@ getptable (struct prpsinfo *baseptr)
+ 
+           /* read the whole file */
+           p = malloc(st.st_size);
+-          (void)pread(fd, p, st.st_size, 0);
++          if (pread(fd, p, st.st_size, 0) != st.st_size)
++          {
++              (void) close(fd);
++              op->fd_lpsinfo = -1;
++              free(p);
++              continue;
++          }
+ 
+           /* cache the file descriptor if we can */
+           if (fd < maxfiles)
+@@ -2148,7 +2154,7 @@ getptable (struct prpsinfo *baseptr)
+               op->oldtime = TIMESPEC_TO_DOUBLE(lwpp->pr_time);
+               op->seen = 1;
+           }
+-          free(p);
++          free(prp);
+       }
+ #endif
+ 

diff --git a/sys-process/unixtop/files/unixtop-3.8_beta1-ncurses.patch 
b/sys-process/unixtop/files/unixtop-3.8_beta1-ncurses.patch
index 73cd88b7282..a2da4b47da6 100644
--- a/sys-process/unixtop/files/unixtop-3.8_beta1-ncurses.patch
+++ b/sys-process/unixtop/files/unixtop-3.8_beta1-ncurses.patch
@@ -1,8 +1,8 @@
 * check ncurses first, such that we only link agains (system) termcap if
   necessary (never the case in prefix) -- [email protected]
 
---- configure.ac
-+++ configure.ac
+--- a/configure.ac
++++ b/configure.ac
 @@ -174,7 +174,7 @@
  AC_CHECK_LIB(kvm, kvm_open)
  # -lmld -lmach

diff --git a/sys-process/unixtop/files/unixtop-3.8_beta1-no-AX-macros.patch 
b/sys-process/unixtop/files/unixtop-3.8_beta1-no-AX-macros.patch
index f5d34a4a9ae..88fd475fe61 100644
--- a/sys-process/unixtop/files/unixtop-3.8_beta1-no-AX-macros.patch
+++ b/sys-process/unixtop/files/unixtop-3.8_beta1-no-AX-macros.patch
@@ -1,8 +1,8 @@
 * no idea where these macros are, but we can surely do without this, for
   now -- [email protected]
 
---- configure.ac
-+++ configure.ac
+--- a/configure.ac
++++ b/configure.ac
 @@ -504,16 +504,6 @@
  
  AC_MSG_RESULT($result)

diff --git a/sys-process/unixtop/unixtop-3.8_beta1-r3.ebuild 
b/sys-process/unixtop/unixtop-3.8_beta1-r3.ebuild
index d32e3863a6f..c4f9598cf00 100644
--- a/sys-process/unixtop/unixtop-3.8_beta1-r3.ebuild
+++ b/sys-process/unixtop/unixtop-3.8_beta1-r3.ebuild
@@ -1,9 +1,9 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=6
 
-inherit eutils autotools
+inherit autotools
 
 DESCRIPTION="top for UNIX systems"
 HOMEPAGE="http://unixtop.sourceforge.net/";
@@ -19,14 +19,17 @@ DEPEND="${RDEPEND}"
 
 S=${WORKDIR}/top-${PV/_/}
 
+PATCHES=(
+       "${FILESDIR}"/${PN}-3.8_beta1-ncurses.patch
+       "${FILESDIR}"/${PN}-3.8_beta1-no-AX-macros.patch
+       "${FILESDIR}"/${PN}-3.8_beta1-renice-segfault.patch
+       "${FILESDIR}"/${PN}-3.8_beta1-memleak-fix-v2.patch
+       "${FILESDIR}"/${PN}-3.8_beta1-high-threadid-crash.patch
+       "${FILESDIR}"/${PN}-3.8_beta1-percent-cpu.patch
+)
+
 src_prepare() {
-       epatch "${FILESDIR}"/${P}-ncurses.patch
-       epatch "${FILESDIR}"/${P}-no-AX-macros.patch
-       epatch "${FILESDIR}"/${P}-renice-segfault.patch
-       epatch "${FILESDIR}"/${P}-memleak-fix-v2.patch
-       epatch "${FILESDIR}"/${P}-high-threadid-crash.patch
-       epatch "${FILESDIR}"/${P}-percent-cpu.patch
-       eapply_user
+       default
        eautoreconf
 }
 

Reply via email to