.
OBS-URL: https://build.opensuse.org/package/show/Base:System/psmisc?expand=0&rev=78
This commit is contained in:
parent
40d4a71eaf
commit
32ed10ffb2
@ -1,6 +1,10 @@
|
||||
---
|
||||
src/pstree.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- src/pstree.c
|
||||
+++ src/pstree.c 2010-07-13 10:14:50.978925622 +0000
|
||||
@@ -868,7 +868,7 @@ int main(int argc, char **argv)
|
||||
+++ src/pstree.c 2017-06-20 13:50:18.024118675 +0000
|
||||
@@ -1093,7 +1093,7 @@ int main(int argc, char **argv)
|
||||
} else if (isatty(1) && (termname = getenv("TERM")) &&
|
||||
(strlen(termname) > 0) &&
|
||||
(setupterm(NULL, 1 /* stdout */ , NULL) == OK) &&
|
||||
|
82
psmisc-22.21-lessnfs.patch
Normal file
82
psmisc-22.21-lessnfs.patch
Normal file
@ -0,0 +1,82 @@
|
||||
Use string comparision only if case of searching for NFS shares
|
||||
|
||||
---
|
||||
src/fuser.c | 30 +++++++++++++++++++++---------
|
||||
src/fuser.h | 2 +-
|
||||
2 files changed, 22 insertions(+), 10 deletions(-)
|
||||
|
||||
--- src/fuser.c
|
||||
+++ src/fuser.c 2017-06-20 13:57:15.420444608 +0000
|
||||
@@ -1831,7 +1831,7 @@ static void clear_mntinfo(void)
|
||||
|
||||
static void init_mntinfo(void)
|
||||
{
|
||||
- char mpoint[PATH_MAX + 1];
|
||||
+ char mpoint[PATH_MAX+1], type[256];
|
||||
int mid, parid, max = 0;
|
||||
uint maj, min;
|
||||
list_t sort;
|
||||
@@ -1842,8 +1842,8 @@ static void init_mntinfo(void)
|
||||
if ((mnt = fopen("/proc/self/mountinfo", "r")) == (FILE *) 0)
|
||||
return;
|
||||
while (fscanf
|
||||
- (mnt, "%i %i %u:%u %*s %s %*[^\n]", &mid, &parid, &maj, &min,
|
||||
- &mpoint[0]) == 5) {
|
||||
+ (mnt, "%i %i %u:%u %*s %s %*s %*s - %s %*[^\n]",
|
||||
+ &mid, &parid, &maj, &min, &mpoint[0], &type[0]) == 6) {
|
||||
const size_t nlen = strlen(mpoint);
|
||||
mntinfo_t *restrict mnt;
|
||||
if (posix_memalign
|
||||
@@ -1862,6 +1862,9 @@ static void init_mntinfo(void)
|
||||
mnt->parid = parid;
|
||||
mnt->dev = makedev(maj, min);
|
||||
mnt->id = mid;
|
||||
+ if (strncmp("nfs", type, 3) == 0)
|
||||
+ mnt->nfs = 1;
|
||||
+ else mnt->nfs = 0;
|
||||
if (mid > max)
|
||||
max = mid;
|
||||
}
|
||||
@@ -1929,16 +1932,25 @@ static int mntstat(const char *path, str
|
||||
if (nlen < mnt->nlen)
|
||||
continue;
|
||||
if (mnt->nlen == 1) { /* root fs is the last entry */
|
||||
- buf->st_dev = mnt->dev;
|
||||
- buf->st_ino = 0;
|
||||
- return 0;
|
||||
+ if (mnt->nfs) {
|
||||
+ fprintf(stderr, "NFS %s\n", use);
|
||||
+ buf->st_dev = mnt->dev;
|
||||
+ buf->st_ino = 0;
|
||||
+ return 0;
|
||||
+ }
|
||||
+ errno = 0;
|
||||
+ return stat(path, buf);
|
||||
}
|
||||
if (use[mnt->nlen] != '\0' && use[mnt->nlen] != '/')
|
||||
continue;
|
||||
if (strncmp(use, mnt->mpoint, mnt->nlen) == 0) {
|
||||
- buf->st_dev = mnt->dev;
|
||||
- buf->st_ino = 0;
|
||||
- return 0;
|
||||
+ if (mnt->nfs) {
|
||||
+ buf->st_dev = mnt->dev;
|
||||
+ buf->st_ino = 0;
|
||||
+ return 0;
|
||||
+ }
|
||||
+ errno = 0;
|
||||
+ return stat(path, buf);
|
||||
}
|
||||
}
|
||||
errno = ENOENT;
|
||||
--- src/fuser.h
|
||||
+++ src/fuser.h 2017-06-20 13:57:15.424444535 +0000
|
||||
@@ -90,7 +90,7 @@ struct mount_list {
|
||||
# include "lists.h"
|
||||
typedef struct mntinfo_s {
|
||||
list_t this;
|
||||
- int id, parid;
|
||||
+ int id, parid, nfs:1;
|
||||
dev_t dev;
|
||||
size_t nlen;
|
||||
char *mpoint;
|
23
psmisc-22.21-mntpt.patch
Normal file
23
psmisc-22.21-mntpt.patch
Normal file
@ -0,0 +1,23 @@
|
||||
For bug boo#908068: fuser -m not handling block devices properly
|
||||
Avoid string comparision for device files
|
||||
|
||||
---
|
||||
src/fuser.c | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
--- src/fuser.c
|
||||
+++ src/fuser.c 2017-06-20 13:56:29.717283482 +0000
|
||||
@@ -1915,6 +1915,13 @@ static int mntstat(const char *path, str
|
||||
errno = 0;
|
||||
return stat(path, buf);
|
||||
}
|
||||
+ if (strncmp("/dev/", use, 5) == 0) {
|
||||
+ /*
|
||||
+ * Could be a special file (socket, pipe, inotify)
|
||||
+ */
|
||||
+ errno = 0;
|
||||
+ return stat(path, buf);
|
||||
+ }
|
||||
|
||||
nlen = strlen(use);
|
||||
list_for_each(ptr, &mntinfo) {
|
@ -1,5 +1,10 @@
|
||||
---
|
||||
configure.ac | 4 ++--
|
||||
src/fuser.c | 16 ++++++++++------
|
||||
2 files changed, 12 insertions(+), 8 deletions(-)
|
||||
|
||||
--- configure.ac
|
||||
+++ configure.ac 2010-10-15 09:00:33.000000000 +0000
|
||||
+++ configure.ac 2017-06-20 13:46:32.464296485 +0000
|
||||
@@ -40,7 +40,7 @@ fi
|
||||
if test "$enable_timeout_stat" = "static"; then
|
||||
AC_DEFINE([WITH_TIMEOUT_STAT], [2], [Use timeout on stat calls])
|
||||
@ -19,8 +24,16 @@
|
||||
AC_CHECK_MEMBERS([struct pt_regs.orig_gpr3,
|
||||
struct pt_regs.gpr], [],[], [#include <linux/ptrace.h>])
|
||||
--- src/fuser.c
|
||||
+++ src/fuser.c 2014-03-24 15:56:40.134235583 +0000
|
||||
@@ -901,6 +901,7 @@ int main(int argc, char *argv[])
|
||||
+++ src/fuser.c 2017-06-20 13:46:32.548294929 +0000
|
||||
@@ -34,6 +34,7 @@
|
||||
#include <errno.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
+#include <sys/sysmacros.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/wait.h>
|
||||
@@ -901,6 +902,7 @@ int main(int argc, char *argv[])
|
||||
struct option *optr;
|
||||
char *nsptr;
|
||||
int skip_argv;
|
||||
@ -28,7 +41,7 @@
|
||||
|
||||
struct option options[] = {
|
||||
{"all", 0, NULL, 'a'},
|
||||
@@ -941,6 +942,7 @@ int main(int argc, char *argv[])
|
||||
@@ -941,6 +943,7 @@ int main(int argc, char *argv[])
|
||||
fill_unix_cache(&unixsockets);
|
||||
#endif
|
||||
|
||||
@ -36,7 +49,7 @@
|
||||
for (argc_cnt = 1; argc_cnt < argc; argc_cnt++) {
|
||||
current_argv = argv[argc_cnt];
|
||||
if (current_argv[0] == '-') { /* its an option */
|
||||
@@ -1093,6 +1095,7 @@ int main(int argc, char *argv[])
|
||||
@@ -1093,6 +1096,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
this_name->matched_procs = NULL;
|
||||
@ -44,7 +57,7 @@
|
||||
if (opts & (OPT_MOUNTS | OPT_ISMOUNTPOINT)
|
||||
&& this_name->name_space != NAMESPACE_FILE)
|
||||
usage(_
|
||||
@@ -1144,7 +1147,7 @@ int main(int argc, char *argv[])
|
||||
@@ -1144,7 +1148,7 @@ int main(int argc, char *argv[])
|
||||
names_tail->next = this_name;
|
||||
names_tail = this_name;
|
||||
} /* for across the argvs */
|
||||
@ -53,3 +66,34 @@
|
||||
usage(_("No process specification given"));
|
||||
|
||||
/* Check if -M flag was used and if so check mounts */
|
||||
@@ -1394,17 +1398,17 @@ check_dir(const pid_t pid, const char *d
|
||||
struct device_list *dev_tmp;
|
||||
struct unixsocket_list *sock_tmp;
|
||||
struct stat st, lst;
|
||||
- char dirpath[MAX_PATHNAME];
|
||||
- char filepath[MAX_PATHNAME];
|
||||
+ char dirpath[PATH_MAX+1];
|
||||
+ char filepath[PATH_MAX+1];
|
||||
|
||||
- snprintf(dirpath, MAX_PATHNAME, "/proc/%d/%s", pid, dirname);
|
||||
+ snprintf(dirpath, PATH_MAX , "/proc/%d/%s", pid, dirname);
|
||||
if ((dirp = opendir(dirpath)) == NULL)
|
||||
return;
|
||||
while ((direntry = readdir(dirp)) != NULL) {
|
||||
if (direntry->d_name[0] < '0' || direntry->d_name[0] > '9')
|
||||
continue;
|
||||
|
||||
- snprintf(filepath, MAX_PATHNAME, "/proc/%d/%s/%s",
|
||||
+ snprintf(filepath, PATH_MAX, "/proc/%d/%s/%s",
|
||||
pid, dirname, direntry->d_name);
|
||||
|
||||
if (timeout(thestat, filepath, &st, 5) != 0) {
|
||||
@@ -1541,7 +1545,7 @@ void fill_unix_cache(struct unixsocket_l
|
||||
while (fgets(line, BUFSIZ, fp) != NULL) {
|
||||
char *path;
|
||||
char *scanned_path = NULL;
|
||||
- if (sscanf(line, "%*x: %*x %*x %*x %*x %*d %d %as",
|
||||
+ if (sscanf(line, "%*x: %*x %*x %*x %*x %*d %d %ms",
|
||||
&scanned_inode, &scanned_path) != 2) {
|
||||
if (scanned_path)
|
||||
free(scanned_path);
|
||||
|
@ -12,8 +12,13 @@ Date: Fri Feb 28 21:55:02 2014 +1100
|
||||
Signed-off-by: Craig Small <csmall@enc.com.au>
|
||||
|
||||
================================================================================
|
||||
---
|
||||
psmisc-22.21/ChangeLog | 3 +++
|
||||
psmisc-22.21/src/fuser.c | 2 +-
|
||||
2 files changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
--- psmisc-22.21/ChangeLog
|
||||
+++ psmisc-22.21/ChangeLog
|
||||
+++ psmisc-22.21/ChangeLog 2017-06-20 13:49:45.560719825 +0000
|
||||
@@ -1,3 +1,6 @@
|
||||
+Changes in 22.22
|
||||
+================
|
||||
@ -22,8 +27,8 @@ Date: Fri Feb 28 21:55:02 2014 +1100
|
||||
/proc/self/mountinfo optional
|
||||
* Make timeout() in timeout.c work with shared mmap to
|
||||
--- psmisc-22.21/src/fuser.c
|
||||
+++ psmisc-22.21/src/fuser.c
|
||||
@@ -1151,7 +1151,7 @@
|
||||
+++ psmisc-22.21/src/fuser.c 2017-06-20 13:49:45.564719750 +0000
|
||||
@@ -1148,7 +1148,7 @@ int main(int argc, char *argv[])
|
||||
usage(_("No process specification given"));
|
||||
|
||||
/* Check if -M flag was used and if so check mounts */
|
||||
|
@ -1,3 +1,14 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Jun 20 14:00:36 UTC 2017 - werner@suse.de
|
||||
|
||||
- Modify psmisc-22.21.dif to enforce the usage of `m' flag in
|
||||
sscanf() instead of `a' for allocation. Also avoid to small
|
||||
buffers and include sys/sysmacros.h for makedev macro.
|
||||
- Add the patch psmisc-22.21-lessnfs.patch to support device
|
||||
files of mount points as well (boo#1044638)
|
||||
- Add the patch psmisc-22.21-mntpt.patch to do strinfg comparision
|
||||
only for NFS shares
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu May 21 13:39:34 UTC 2015 - schwab@suse.de
|
||||
|
||||
|
20
psmisc.spec
20
psmisc.spec
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package psmisc
|
||||
#
|
||||
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -31,11 +31,15 @@ Summary: Utilities for managing processes on your system
|
||||
License: GPL-2.0+
|
||||
Group: System/Monitoring
|
||||
Source: http://sourceforge.net/projects/psmisc/files/psmisc/%{name}-%{version}.tar.gz
|
||||
Patch0: %name-22.21.dif
|
||||
Patch1: %name-22.12-tigetstr.patch
|
||||
Patch2: %name-22.21-pstree.patch
|
||||
# PATCH-FIX-SUSE boo#boo908063 -- partly upstream already
|
||||
Patch3: %name-22.21-boo908063.patch
|
||||
Patch0: %{name}-22.21.dif
|
||||
Patch1: %{name}-22.12-tigetstr.patch
|
||||
Patch2: %{name}-22.21-pstree.patch
|
||||
# PATCH-FIX-SUSE boo#908063 -- partly upstream already
|
||||
Patch3: %{name}-22.21-boo908063.patch
|
||||
# PATCH-FIX-SUSE boo#908068 -- fuser -m not handling block devices properly
|
||||
Patch4: %{name}-22.21-mntpt.patch
|
||||
# PATCH-ADD-SUSE use string comparision only for nfs shares
|
||||
Patch5: %{name}-22.21-lessnfs.patch
|
||||
Patch42: %{name}-22.21-upstream.patch
|
||||
# PATCH-FIX-UPSTREAM psmisc-git-3638cc55b4d08851faba46635d737b24d016665b.patch bnc#874983
|
||||
Patch43: %{name}-git-3638cc55b4d08851faba46635d737b24d016665b.patch
|
||||
@ -55,11 +59,13 @@ processes that are using specified files or filesystems.
|
||||
%prep
|
||||
%setup -q
|
||||
%patch42 -p0 -b .up
|
||||
%patch43 -p1 -b .fuserfix
|
||||
%patch1 -p0 -b .tigetstr
|
||||
%patch2 -p0 -b .pstree
|
||||
%patch3 -p0 -b .thread
|
||||
%patch4 -p0 -b .mntpt
|
||||
%patch5 -p0 -b .lessnfs
|
||||
%patch0 -p0 -b .0
|
||||
%patch43 -p1 -b .fuserfix
|
||||
|
||||
%build
|
||||
autoreconf -fi
|
||||
|
Loading…
Reference in New Issue
Block a user