Accepting request 526990 from Base:System

- Add patch psmisc-23.0-killall-signals.patch to fix boo#1058990
  by prior scanning for signal names in the arguments of killall

OBS-URL: https://build.opensuse.org/request/show/526990
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/psmisc?expand=0&rev=65
This commit is contained in:
Dominique Leuenberger 2017-09-21 10:31:59 +00:00 committed by Git OBS Bridge
commit 65f90de844
3 changed files with 97 additions and 1 deletions

View File

@ -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;

View File

@ -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

View File

@ -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