Skip to content

tail: replace unsafe libc::kill by rustix#11725

Merged
cakebaker merged 1 commit into
uutils:mainfrom
mattsu2020:tail_rustix
Apr 10, 2026
Merged

tail: replace unsafe libc::kill by rustix#11725
cakebaker merged 1 commit into
uutils:mainfrom
mattsu2020:tail_rustix

Conversation

@mattsu2020
Copy link
Copy Markdown
Contributor

@mattsu2020 mattsu2020 commented Apr 9, 2026

Summary

  • Replace unsafe { libc::kill(pid, 0) } calls with the safe rustix::process::test_kill_process API
  • Remove the get_errno helper and std::io::Error import, using match on rustix::io::Errno variants instead
  • Add process feature to the existing rustix dependency in uu_tail/Cargo.toml

This eliminates all unsafe blocks from src/uu/tail/src/platform/unix.rs.

Use `rustix::process::test_kill_process` (a safe wrapper around
`kill(pid, 0)`) to eliminate the remaining `unsafe` blocks in
src/uu/tail/src/platform/unix.rs. This removes the direct `libc::kill`
calls and the `get_errno` helper, replacing them with idiomatic
`match` on `rustix::io::Errno` variants.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 9, 2026

GNU testsuite comparison:

Skip an intermittent issue tests/pr/bounded-memory (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/tail/symlink (fails in this run but passes in the 'main' branch)
Note: The gnu test tests/seq/seq-epipe is now being skipped but was previously passing.

@cakebaker cakebaker merged commit d6cadd4 into uutils:main Apr 10, 2026
187 of 229 checks passed
@cakebaker
Copy link
Copy Markdown
Contributor

Thanks!

@mattsu2020 mattsu2020 deleted the tail_rustix branch April 10, 2026 23:48
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