Gentoo Archives: gentoo-commits

From: Lars Wendler <polynomial-c@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-process/psmisc/files/, sys-process/psmisc/
Date: Wed, 19 Sep 2018 08:32:49
Message-Id: 1537345949.27aa227016ac71f90eb8c6036ab4fb2600433b02.polynomial-c@gentoo
1 commit: 27aa227016ac71f90eb8c6036ab4fb2600433b02
2 Author: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
3 AuthorDate: Wed Sep 19 08:32:29 2018 +0000
4 Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
5 CommitDate: Wed Sep 19 08:32:29 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=27aa2270
7
8 sys-process/psmisc: v23.2: Attempt to fix "killall -SIG"
9
10 Bug: https://bugs.gentoo.org/664066
11 Package-Manager: Portage-2.3.49, Repoman-2.3.10
12
13 .../psmisc-23.2-killall_options_parsing.patch | 79 ++++++++++++++++++++++
14 sys-process/psmisc/psmisc-23.2.ebuild | 4 ++
15 2 files changed, 83 insertions(+)
16
17 diff --git a/sys-process/psmisc/files/psmisc-23.2-killall_options_parsing.patch b/sys-process/psmisc/files/psmisc-23.2-killall_options_parsing.patch
18 new file mode 100644
19 index 00000000000..48aecb24e5c
20 --- /dev/null
21 +++ b/sys-process/psmisc/files/psmisc-23.2-killall_options_parsing.patch
22 @@ -0,0 +1,79 @@
23 +From 258ee9166e585f87005d3a9686938a4fa26669f9 Mon Sep 17 00:00:00 2001
24 +From: Craig Small <csmall@×××××××.au>
25 +Date: Tue, 18 Sep 2018 21:17:00 +1000
26 +Subject: [PATCH] killall: Another go at option parsing
27 +
28 +This now seems to be working. There are some evil hacks, especially for
29 +the -ve option combination but it seems that we have a winner.
30 +
31 +Added a bunch more option parsing tests which picked up -ILL passed but
32 +-VTALRM did not. Not sure why, but length seems my guess
33 +
34 +References:
35 + psmisc/psmisc#13
36 + psmisc/psmisc#12
37 +---
38 +
39 +diff --git a/src/killall.c b/src/killall.c
40 +index 64c406a..2715515 100644
41 +--- a/src/killall.c
42 ++++ b/src/killall.c
43 +@@ -857,7 +857,7 @@ main (int argc, char **argv)
44 +
45 + opterr = 0;
46 + #ifdef WITH_SELINUX
47 +- while ( (optc = getopt_long(argc,argv,"egy:o:ilqrs:u:vwZ:VIn:",options,NULL)) != -1) {
48 ++ while ( (optc = getopt_long_only(argc,argv,"egy:o:ilqrs:u:vwZ:VIn:",options,NULL)) != -1) {
49 + #else
50 + while ( (optc = getopt_long_only(argc,argv,"egy:o:ilqrs:u:vwVIn:",options,NULL)) != -1) {
51 + #endif
52 +@@ -914,7 +914,7 @@ main (int argc, char **argv)
53 + ignore_case = 1;
54 + } else {
55 + sig_num = get_signal (argv[optind]+1, "killall");
56 +- skip_error=1;
57 ++ skip_error=optind;
58 + }
59 + break;
60 + case 'V':
61 +@@ -922,8 +922,10 @@ main (int argc, char **argv)
62 + if (strcmp(argv[optind-1],"-V") == 0 || strncmp(argv[optind-1],"--",2) == 0) {
63 + print_version();
64 + return 0;
65 ++ } else {
66 ++ sig_num = get_signal (argv[optind]+1, "killall");
67 ++ skip_error=optind;
68 + }
69 +- sig_num = get_signal (argv[optind]+1, "killall");
70 + break;
71 + case 'n': {
72 + long num;
73 +@@ -948,6 +950,15 @@ main (int argc, char **argv)
74 + break;
75 + #endif /*WITH_SELINUX*/
76 + case '?':
77 ++ if (skip_error == optind)
78 ++ break;
79 ++ /* Sigh, this is a hack because -ve could be -version or
80 ++ * -verbose */
81 ++ if (strncmp(argv[optind-1], "-ve", 3) == 0) {
82 ++ verbose=1;
83 ++ exact=1;
84 ++ break;
85 ++ }
86 + /* Signal names are in uppercase, so check to see if the argv
87 + * is upper case */
88 + if (argv[optind-1][1] >= 'A' && argv[optind-1][1] <= 'Z') {
89 +@@ -957,9 +968,6 @@ main (int argc, char **argv)
90 + if (argv[optind-1][1] >= '0' && argv[optind-1][1] <= '9') {
91 + sig_num = atoi(argv[optind-1]+1);
92 + } else {
93 +- if (skip_error)
94 +- skip_error=0;
95 +- else
96 + usage(NULL);
97 + }
98 + }
99 +--
100 +2.18.0
101 +
102
103 diff --git a/sys-process/psmisc/psmisc-23.2.ebuild b/sys-process/psmisc/psmisc-23.2.ebuild
104 index 5b4a7b8c712..dd989ab0b6b 100644
105 --- a/sys-process/psmisc/psmisc-23.2.ebuild
106 +++ b/sys-process/psmisc/psmisc-23.2.ebuild
107 @@ -21,6 +21,10 @@ DEPEND="${RDEPEND}
108
109 DOCS=( AUTHORS ChangeLog NEWS README )
110
111 +PATCHES=(
112 + "${FILESDIR}/${P}-killall_options_parsing.patch"
113 +)
114 +
115 src_configure() {
116 local myeconfargs=(
117 --disable-harden-flags