-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kill: fix the fail to use only least significant bits to identify signal with -l #7225
Changes from 2 commits
4189f20
2089a9c
269684d
cffe7c8
13b0276
da74927
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -334,6 +334,15 @@ fn test_kill_with_signal_and_list() { | |
.fails(); | ||
} | ||
|
||
#[test] | ||
fn test_kill_with_list_lower_bits() { | ||
new_ucmd!() | ||
.arg("-l") | ||
.arg("143") | ||
.succeeds() | ||
.stdout_matches(&Regex::new("TERM").unwrap()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While this works, I think using a regex is a bit overkill and you can simplify it by using either There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you, I have just seen the function There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, that's also fine. |
||
} | ||
|
||
#[test] | ||
fn test_kill_with_signal_and_table() { | ||
let target = Target::new(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please document this magic number :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is not entirely correct, because it recognizes, for example,
111
(=b1101111
) as a TERM signal whereas GNUkill
doesn't recognize it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes you are right. I have done some tests and the range of number accepted goes from 0 to 64 and from 128 to 192 (both endings included). It is like they are managing the same signals but mapped 2 times.
I noticed also that we don't manage the name of the signals from 32 to 64 (and therefore also from 160 to 192).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could add this feature in this pull request or should I open a new one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would create a new PR. There is also a ticket for it: #6218