diff -Nru psmisc-23.1/debian/changelog psmisc-23.1/debian/changelog --- psmisc-23.1/debian/changelog 2018-05-03 15:20:47.000000000 +0000 +++ psmisc-23.1/debian/changelog 2018-12-11 15:46:04.000000000 +0000 @@ -1,3 +1,12 @@ +psmisc (23.1-1ubuntu1.1) cosmic; urgency=medium + + * fix killall option parsing (LP: #1806060) + - d/patches/lp1806060-0001-killall-Fix-INT-option-parsing.patch + - d/patches/lp1806060-0002-killall-change-to-getopt_long.patch + - d/patches/lp1806060-0003-killall-Another-go-at-option-parsing.patch + + -- Christian Ehrhardt Tue, 11 Dec 2018 16:46:04 +0100 + psmisc (23.1-1build1) cosmic; urgency=medium * No-change rebuild for ncurses soname changes. diff -Nru psmisc-23.1/debian/patches/lp1806060-0001-killall-Fix-INT-option-parsing.patch psmisc-23.1/debian/patches/lp1806060-0001-killall-Fix-INT-option-parsing.patch --- psmisc-23.1/debian/patches/lp1806060-0001-killall-Fix-INT-option-parsing.patch 1970-01-01 00:00:00.000000000 +0000 +++ psmisc-23.1/debian/patches/lp1806060-0001-killall-Fix-INT-option-parsing.patch 2018-12-11 15:46:04.000000000 +0000 @@ -0,0 +1,49 @@ +From cf80d701397d2ff705ab1c1250e3906f32034539 Mon Sep 17 00:00:00 2001 +From: Craig Small +Date: Sun, 20 May 2018 20:42:12 +1000 +Subject: [PATCH] killall: Fix -INT option parsing + +Sometimes killall gets confused between a signal name and a set of +options. This small patch should un-confuse it. + +Author: Christian Ehrhardt +Original-Author: Craig Small +Origin: backport, https://gitlab.com/psmisc/psmisc/commit/cf80d701397d2ff705ab1c1250e3906f32034539 +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1806060 +Last-Update: 2018-12-11 + +--- + ChangeLog | 1 + + src/killall.c | 7 ++++++- + 2 files changed, 7 insertions(+), 1 deletion(-) + +--- a/src/killall.c ++++ b/src/killall.c +@@ -803,6 +803,7 @@ main (int argc, char **argv) + int sig_num; + int optc; + int myoptind; ++ int skip_error=0; + struct passwd *pwent = NULL; + char yt[16]; + char ot[16]; +@@ -912,6 +913,7 @@ main (int argc, char **argv) + ignore_case = 1; + } else { + sig_num = get_signal (argv[optind]+1, "killall"); ++ skip_error=1; + } + break; + case 'V': +@@ -947,7 +949,10 @@ main (int argc, char **argv) + if (argv[optind-1][1] >= '0' && argv[optind-1][1] <= '9') { + sig_num = atoi(argv[optind-1]+1); + } else { +- usage(NULL); ++ if (skip_error) ++ skip_error=0; ++ else ++ usage(NULL); + } + } + break; diff -Nru psmisc-23.1/debian/patches/lp1806060-0002-killall-change-to-getopt_long.patch psmisc-23.1/debian/patches/lp1806060-0002-killall-change-to-getopt_long.patch --- psmisc-23.1/debian/patches/lp1806060-0002-killall-change-to-getopt_long.patch 1970-01-01 00:00:00.000000000 +0000 +++ psmisc-23.1/debian/patches/lp1806060-0002-killall-change-to-getopt_long.patch 2018-12-11 15:46:04.000000000 +0000 @@ -0,0 +1,37 @@ +From b769da1626044f97a689c1665270595f36f878e7 Mon Sep 17 00:00:00 2001 +From: Craig Small +Date: Sun, 20 May 2018 20:46:55 +1000 +Subject: [PATCH] killall: change to getopt_long + +with getopt_long_only -ve fails because its not sure what the -v +is for --version or --verbose. Changing to the non-_only version means +it doesn't try to expand the options to long options. + +References: + psmisc/psmisc#12 + +Author: Christian Ehrhardt +Original-Author: Craig Small +Origin: backport, https://gitlab.com/psmisc/psmisc/commit/b769da1626044f97a689c1665270595f36f878e7 +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1806060 +Last-Update: 2018-12-11 + +--- + ChangeLog | 1 + + src/killall.c | 4 ++-- + 2 files changed, 3 insertions(+), 2 deletions(-) + +--- a/src/killall.c ++++ b/src/killall.c +@@ -856,9 +856,9 @@ main (int argc, char **argv) + + opterr = 0; + #ifdef WITH_SELINUX +- while ( (optc = getopt_long_only(argc,argv,"egy:o:ilqrs:u:vwZ:VIn:",options,NULL)) != -1) { ++ while ( (optc = getopt_long(argc,argv,"egy: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(argc,argv,"egy:o:ilqrs:u:vwVIn:",options,NULL)) != -1) { + #endif + switch (optc) { + case 'e': diff -Nru psmisc-23.1/debian/patches/lp1806060-0003-killall-Another-go-at-option-parsing.patch psmisc-23.1/debian/patches/lp1806060-0003-killall-Another-go-at-option-parsing.patch --- psmisc-23.1/debian/patches/lp1806060-0003-killall-Another-go-at-option-parsing.patch 1970-01-01 00:00:00.000000000 +0000 +++ psmisc-23.1/debian/patches/lp1806060-0003-killall-Another-go-at-option-parsing.patch 2018-12-11 15:46:04.000000000 +0000 @@ -0,0 +1,87 @@ +From 258ee9166e585f87005d3a9686938a4fa26669f9 Mon Sep 17 00:00:00 2001 +From: Craig Small +Date: Tue, 18 Sep 2018 21:17:00 +1000 +Subject: [PATCH] killall: Another go at option parsing + +This now seems to be working. There are some evil hacks, especially for +the -ve option combination but it seems that we have a winner. + +Added a bunch more option parsing tests which picked up -ILL passed but +-VTALRM did not. Not sure why, but length seems my guess + +References: + psmisc/psmisc#13 + psmisc/psmisc#12 + +Author: Christian Ehrhardt +Original-Author: Craig Small +Origin: backport, https://gitlab.com/psmisc/psmisc/commit/258ee9166e585f87005d3a9686938a4fa26669f9 +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1806060 +Last-Update: 2018-12-11 + +--- + ChangeLog | 2 +- + src/killall.c | 20 ++++++++++++++------ + testsuite/killall.test/killall.exp | 13 +++++++++++++ + 3 files changed, 28 insertions(+), 7 deletions(-) + +--- a/src/killall.c ++++ b/src/killall.c +@@ -856,7 +856,7 @@ main (int argc, char **argv) + + opterr = 0; + #ifdef WITH_SELINUX +- while ( (optc = getopt_long(argc,argv,"egy:o:ilqrs:u:vwZ:VIn:",options,NULL)) != -1) { ++ while ( (optc = getopt_long_only(argc,argv,"egy:o:ilqrs:u:vwZ:VIn:",options,NULL)) != -1) { + #else + while ( (optc = getopt_long(argc,argv,"egy:o:ilqrs:u:vwVIn:",options,NULL)) != -1) { + #endif +@@ -913,7 +913,7 @@ main (int argc, char **argv) + ignore_case = 1; + } else { + sig_num = get_signal (argv[optind]+1, "killall"); +- skip_error=1; ++ skip_error=optind; + } + break; + case 'V': +@@ -921,8 +921,10 @@ main (int argc, char **argv) + if (strcmp(argv[optind-1],"-V") == 0 || strncmp(argv[optind-1],"--",2) == 0) { + print_version(); + return 0; ++ } else { ++ sig_num = get_signal (argv[optind]+1, "killall"); ++ skip_error=optind; + } +- sig_num = get_signal (argv[optind]+1, "killall"); + break; + case 'n': + opt_ns_pid = atoi(optarg); +@@ -940,6 +942,15 @@ main (int argc, char **argv) + break; + #endif /*WITH_SELINUX*/ + case '?': ++ if (skip_error == optind) ++ break; ++ /* Sigh, this is a hack because -ve could be -version or ++ * -verbose */ ++ if (strncmp(argv[optind-1], "-ve", 3) == 0) { ++ verbose=1; ++ exact=1; ++ break; ++ } + /* Signal names are in uppercase, so check to see if the argv + * is upper case */ + if (argv[optind-1][1] >= 'A' && argv[optind-1][1] <= 'Z') { +@@ -949,10 +960,7 @@ main (int argc, char **argv) + if (argv[optind-1][1] >= '0' && argv[optind-1][1] <= '9') { + sig_num = atoi(argv[optind-1]+1); + } else { +- if (skip_error) +- skip_error=0; +- else +- usage(NULL); ++ usage(NULL); + } + } + break; diff -Nru psmisc-23.1/debian/patches/series psmisc-23.1/debian/patches/series --- psmisc-23.1/debian/patches/series 2017-06-15 20:54:49.000000000 +0000 +++ psmisc-23.1/debian/patches/series 2018-12-11 15:46:04.000000000 +0000 @@ -1 +1,4 @@ manpage-fixes +lp1806060-0001-killall-Fix-INT-option-parsing.patch +lp1806060-0002-killall-change-to-getopt_long.patch +lp1806060-0003-killall-Another-go-at-option-parsing.patch