Skip to content

timeout: use nix kill/setpgid to reduce unsafe#10120

Merged
sylvestre merged 2 commits into
uutils:mainfrom
mattsu2020:timeout_refactoring
Jan 9, 2026
Merged

timeout: use nix kill/setpgid to reduce unsafe#10120
sylvestre merged 2 commits into
uutils:mainfrom
mattsu2020:timeout_refactoring

Conversation

@mattsu2020

Copy link
Copy Markdown
Contributor
  • Replace libc::kill(getpid(), signal) and libc::setpgid(0, 0) in timeout with the nix equivalents, removing those unsafe blocks.
  • Improves safety/readability by using higher‑level, checked APIs.

Replace unsafe `libc::kill` and `libc::setpgid` calls in the timeout utility
with safer nix crate wrappers (`kill`, `getpid`, `setpgid`) to reduce unsafe code
usage and improve overall code safety. This maintains functionality while
leveraging Rust's type safety for signal and process group operations.
Reorder nix imports to alphabetical order in timeout.rs for better code organization and readability. No functional changes.
@github-actions

github-actions Bot commented Jan 8, 2026

Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)

@sylvestre
sylvestre merged commit 19d3386 into uutils:main Jan 9, 2026
129 of 130 checks passed
@mattsu2020
mattsu2020 deleted the timeout_refactoring branch January 9, 2026 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants