1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 19:47:45 +00:00

kill: use only least significant bits to identify signal with -l (#7225)

* kill: check the lower 5 bits when the input is a number

* test/kill: added testcase

* kill: check the last 7 bits

* kill: check only the last 8 bits and the signals in the range [128, 159]

---------

Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
This commit is contained in:
Tommaso Fellegara 2025-01-28 10:21:19 +01:00 committed by GitHub
parent 5e81358c4a
commit 1595b6afaa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 50 additions and 2 deletions

View file

@ -334,6 +334,39 @@ fn test_kill_with_signal_and_list() {
.fails();
}
#[test]
fn test_kill_with_list_lower_bits() {
new_ucmd!()
.arg("-l")
.arg("128")
.succeeds()
.stdout_contains("EXIT");
new_ucmd!()
.arg("-l")
.arg("143")
.succeeds()
.stdout_contains("TERM");
new_ucmd!()
.arg("-l")
.arg("256")
.succeeds()
.stdout_contains("EXIT");
new_ucmd!()
.arg("-l")
.arg("2304")
.succeeds()
.stdout_contains("EXIT");
}
#[test]
fn test_kill_with_list_lower_bits_unrecognized() {
new_ucmd!().arg("-l").arg("111").fails();
new_ucmd!().arg("-l").arg("384").fails();
}
#[test]
fn test_kill_with_signal_and_table() {
let target = Target::new();