Commit Graph

8 Commits

Author SHA1 Message Date
Craig Small
aa41c309dd 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
2017-05-22 22:15:59 +10:00
Olof Sivertsson
95ed10ff43 kill: Fix free() with bad pointer on SIG-prefixed signal-name
kill -l SIGHUP (or any other signal-name prefixed with "SIG")
would cause free() to be called with a bad pointer instead of
a pointer to what was allocated. Fix this and add test-case.
2016-09-11 09:58:55 +10:00
Craig Small
6eb4726e6f testsuite: kill test fails on signal names
Some archs have + and - in their signal names, such as hppa
which comes with signals such as RTMIN+-9 RTMIN+-8
The kill -l test failed because of this, we now accept these
odd names.

References:
 https://bugs.debian.org/762764
 https://buildd.debian.org/status/fetch.php?pkg=procps&arch=hppa&ver=1%3A3.3.10-1&stamp=1411601407
2016-04-11 22:12:58 +10:00
Gilles Espinasse
53b253b75a skip kill test too if running runtest
I find more readable instead of make check to run
cd testsuite && make site.exp && DEJAGNU=global-conf.exp runtest

But in that case, kill.exp was still trying to run with
ERROR: tcl error sourcing ./kill.test/kill.exp.
ERROR: couldn't execute "/usr/src/procps-ng-3.3.7/kill": no such file or
directory
...

Simply return from test if kill is not build

Signed-off-by: Gilles Espinasse <g.esp@free.fr>
2013-05-26 07:25:55 +10:00
Craig Small
532dc9239d Updated testsuite files for new NLS output 2012-01-02 17:39:41 +11:00
Sami Kerola
5277341278 tests: clean up kill temporary file
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-03 20:20:27 +01:00
Craig Small
e7a0fe5bee Fixing tests due to some results
Makefile will now only test for Linux systems, a work around in the
makefile due to some silly redefine restrictions.

uptime and w now won't error due to being one user logged in, thanks to
Sami for the patch

kill processes by pid test commented out due to false negatives

pwdx process 1 check also commented out due to false negatives
2011-12-04 00:50:36 +11:00
Craig Small
f05e15e830 More testing added for procps 2011-11-30 23:11:35 +11:00