The 0 (EXIT) signal is valid as input (and useful to determine existence of a pid), so list it along with other signals.
* src/kill.c (list_signals): Start loops at 0, not 1. * tests/misc/kill.sh: Add a test case. * NEWS: Mention the change in behavior. --- NEWS | 2 ++ src/kill.c | 6 +++--- tests/misc/kill.sh | 3 +++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 9c6f2fb0d..f76393506 100644 --- a/NEWS +++ b/NEWS @@ -46,6 +46,8 @@ GNU coreutils NEWS -*- outline -*- install -C now dereferences symlink sources when comparing, rather than always treating as different and performing the copy. + kill -l and -t now list signal 0, as it's a valid signal to send. + ls's -f option now simply acts like -aU, instead of also ignoring some earlier options. For example 'ls -fl' and 'ls -lf' are now equivalent because -f no longer ignores an earlier -l. The new diff --git a/src/kill.c b/src/kill.c index 8b9a2650f..314855653 100644 --- a/src/kill.c +++ b/src/kill.c @@ -120,7 +120,7 @@ list_signals (bool table, char *const *argv) num_width++; /* Compute the maximum width of a signal name. */ - for (signum = 1; signum <= SIGNUM_BOUND; signum++) + for (signum = 0; signum <= SIGNUM_BOUND; signum++) if (sig2str (signum, signame) == 0) { idx_t len = strlen (signame); @@ -142,7 +142,7 @@ list_signals (bool table, char *const *argv) } } else - for (signum = 1; signum <= SIGNUM_BOUND; signum++) + for (signum = 0; signum <= SIGNUM_BOUND; signum++) if (sig2str (signum, signame) == 0) print_table_row (num_width, signum, name_width, signame); } @@ -165,7 +165,7 @@ list_signals (bool table, char *const *argv) printf ("%d\n", signum); } else - for (signum = 1; signum <= SIGNUM_BOUND; signum++) + for (signum = 0; signum <= SIGNUM_BOUND; signum++) if (sig2str (signum, signame) == 0) puts (signame); } diff --git a/tests/misc/kill.sh b/tests/misc/kill.sh index 82812eada..ed4773f65 100755 --- a/tests/misc/kill.sh +++ b/tests/misc/kill.sh @@ -68,4 +68,7 @@ test -n "$SIG_SEQ" || framework_failure_ env kill -l -- $SIG_SEQ || fail=1 env kill -t -- $SIG_SEQ || fail=1 +# Verify first signal number listed is 0 +test $(env kill -l $(env kill -l | head -n1)) = 0 || fail=1 + Exit $fail -- 2.47.1