summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorCraig Small <csmall@enc.com.au>2017-05-22 22:15:59 +1000
committerCraig Small <csmall@enc.com.au>2017-05-22 22:15:59 +1000
commitaa41c309dd393933671e0cedaf8ebe0432ab24c4 (patch)
tree2dacc103293a0b6e5981ca39e5d3fff42b04b84a /testsuite
parent3ad417c0c00b480e56cca86e6ab9e5cbf2c1bbb3 (diff)
downloadprocps-ng-aa41c309dd393933671e0cedaf8ebe0432ab24c4.tar.gz
kill: -l space between name parses correctly
This was supposed to be just a cherry-pick of the referenced commit. However there were two problems: 1. kill code was moved out to its own file 2. strtosig() had a latent bug where signal numbers were not converted to names. Original note: kill -lHUP would work correctly, but kill -l HUP would not. The list option in kill was hit by a quirk of getopt_long where an option with an optional argument would not attempt to get the argument beyond the space, even though a mandatory argument would do that. The fix is a kludge to scan to the next argument and if it looks like something we can use, use it. Lucky for us, the list option is one where parsing can stop immediately. Thanks to Brian Vandenberg for the way forward. References: http://stackoverflow.com/questions/1052746/getopt-does-not-parse-optional-arguments-to-parameters https://bugs.debian.org/854407 commit 537cea324b121f54744369425332c256aa84a181
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/kill.test/kill.exp19
1 files changed, 16 insertions, 3 deletions
diff --git a/testsuite/kill.test/kill.exp b/testsuite/kill.test/kill.exp
index 211395c..1948517 100644
--- a/testsuite/kill.test/kill.exp
+++ b/testsuite/kill.test/kill.exp
@@ -20,15 +20,28 @@ set test "kill list signal names in table"
spawn $kill -L
expect_pass "$test" "^\(\\s+\\d+ \[A-Z12+-\]+\)+\\s*$"
-set test "kill convert signal name to number"
+set test "kill convert signal name to number no space"
spawn $kill -lHUP
expect_pass "$test" "^1\\s*"
-set test "kill convert SIG-prefixed signal name to number"
+set test "kill convert signal name to number with space"
+spawn $kill -l HUP
+expect_pass "$test" "^1\\s*"
+
+set test "kill convert SIG-prefixed signal name to number no space"
spawn $kill -lSIGHUP
expect_pass "$test" "^1\\s*$"
-set test "kill convert signal number to name"
+set test "kill convert SIG-prefixed signal name to number with space"
+spawn $kill -l SIGHUP
+
+expect_pass "$test" "^1\\s*$"
+
+set test "kill convert signal number to name no space"
+spawn $kill -l1
+expect_pass "$test" "^HUP\\s*"
+
+set test "kill convert signal number to name with space"
spawn $kill -l 1
expect_pass "$test" "^HUP\\s*"