From 1acfe1c2fe147d541b12477e568a5b009e9f4bf9 Mon Sep 17 00:00:00 2001 From: "Dr. Werner Fink" Date: Mon, 18 Sep 2017 10:19:15 +0000 Subject: [PATCH] boo#1058990 OBS-URL: https://build.opensuse.org/package/show/Base:System/psmisc?expand=0&rev=93 --- psmisc-23.0-killall-signals.patch | 87 +++++++++++++++++++++++++++++++ psmisc.changes | 6 +++ psmisc.spec | 5 +- 3 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 psmisc-23.0-killall-signals.patch diff --git a/psmisc-23.0-killall-signals.patch b/psmisc-23.0-killall-signals.patch new file mode 100644 index 0000000..4e71d52 --- /dev/null +++ b/psmisc-23.0-killall-signals.patch @@ -0,0 +1,87 @@ +--- src/killall.c 2017-07-06 16:23:15.693736411 +0200 ++++ src/killall.c 2017-09-18 12:00:46.506409019 +0200 +@@ -796,6 +796,18 @@ have_proc_self_stat (void) + return stat(filename, &isproc) == 0; + } + ++typedef struct ++{ ++ int number; ++ const char *sig; ++} ++SIGNAME; ++ ++static SIGNAME signals[] = { ++#include "signames.h" ++ {0, NULL} ++}; ++ + int + main (int argc, char **argv) + { +@@ -807,7 +819,7 @@ main (int argc, char **argv) + char yt[16]; + char ot[16]; + +- //int optsig = 0; ++ int optsig; + + struct option options[] = { + {"exact", 0, NULL, 'e'}, +@@ -828,6 +840,7 @@ main (int argc, char **argv) + {"context", 1, NULL, 'Z'}, + #endif /*WITH_SELINUX*/ + {"version", 0, NULL, 'V'}, ++ {"dummy", 0, NULL, 'd'}, + {0,0,0,0 }}; + + opt_ns_pid = getpid(); +@@ -852,14 +865,46 @@ main (int argc, char **argv) + name = *argv; + sig_num = SIGTERM; + ++ optsig = argc; ++ while (--optsig) { ++ char *sig; ++ size_t len; ++ if (*(argv[optsig]) != '-') ++ continue; ++ sig = argv[optsig]+1; ++ len = strlen(sig); ++ if (*sig >= '0' && *sig <= '9') { ++ sig_num = atoi (sig); ++ memset(sig, 0, strlen(sig)); ++ *sig = 'd'; ++ } else if (len >= 3 && *sig >= 'A' && *sig <= 'Z') { ++ SIGNAME *walk; ++ char *opt = sig; ++ if (!strncmp("SIG", sig, 3)) ++ sig += 3; ++ for (walk = signals; walk->sig; walk++) { ++ if (!strcmp (walk->sig, sig)) ++ break; ++ } ++ if (walk->sig) { ++ sig_num = walk->number; ++ memset(opt, 0, strlen(opt)); ++ *opt = 'd'; ++ break; ++ } ++ } ++ } + + opterr = 0; ++ unsetenv("POSIXLY_CORRECT"); + #ifdef WITH_SELINUX +- while ( (optc = getopt_long_only(argc,argv,"egy:o:ilqrs:u:vwZ:VIn:",options,NULL)) != -1) { ++ while ( (optc = getopt_long_only(argc,argv,"degy:o:ilqrs:u:vwZ:VIn:",options,NULL)) != -1) { + #else +- while ( (optc = getopt_long_only(argc,argv,"egy:o:ilqrs:u:vwVIn:",options,NULL)) != -1) { ++ while ( (optc = getopt_long_only(argc,argv,"degy:o:ilqrs:u:vwVIn:",options,NULL)) != -1) { + #endif + switch (optc) { ++ case 'd': ++ break; + case 'e': + exact = 1; + break; diff --git a/psmisc.changes b/psmisc.changes index 6d6955d..a95f39c 100644 --- a/psmisc.changes +++ b/psmisc.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon Sep 18 10:17:52 UTC 2017 - werner@suse.de + +- Add patch psmisc-23.0-killall-signals.patch to fix boo#1058990 + by prior scanning for signal names in the arguments of killall + ------------------------------------------------------------------- Thu Jul 6 13:59:36 UTC 2017 - werner@suse.de diff --git a/psmisc.spec b/psmisc.spec index 9eaf256..ce1d6f8 100644 --- a/psmisc.spec +++ b/psmisc.spec @@ -40,8 +40,10 @@ Patch2: %{name}-22.21-pstree.patch # PATCH-ADD-SUSE boo#908068, boo#1046237, boo#1046237 # https://gitlab.com/bitstreamout/psmisc/tree/mountinfo Patch3: 0001-Use-mountinfo-to-be-able-to-use-the-mount-identity.patch -# PATCH-FIX_UPSTREAM boo#1046237 -- Debug output in killall from psmisc package +# PATCH-FIX-UPSTREAM boo#1046237 -- Debug output in killall from psmisc package Patch4: %{name}-%{version}-killall.patch +# PATCH-FIX-SUSE boo#1058990 -- killall requires -s or --signal to specify signal on the command line +Patch5: %{name}-%{version}-killall-signals.patch %define have_peekfd %ix86 x86_64 ppc ppc64 ppc64le %arm mipsel m68k @@ -61,6 +63,7 @@ ln -sf %{name}-v%{version}-%{hash} %{name}-%version %patch2 -p0 -b .pstree %patch3 -p0 -b .mntinf %patch4 -p0 -b .ka +%patch5 -p0 -b .ks %patch0 -p0 -b .p0 %build