Draft
Conversation
Replace nix pipe/splice/vmsplice wrappers with rustix equivalents
in uucore's pipes module. Also migrate cat's splice.rs to use
rustix::io::{read, write} instead of nix::unistd.
The return types change from nix::Result to std::io::Result, which
is more idiomatic and compatible with the broader ecosystem.
Replace nix process functions with rustix equivalents: - geteuid/getegid/getuid/getgid/getpid/getpgrp/getsid -> rustix::process - kill/test_kill -> rustix::process::kill_process/test_kill_process - Signal::try_from -> signal_from_raw helper using from_raw_unchecked - SigHandler for send_signal_group -> csignal wrapper The getsid return type changes from Result<pid_t, Errno> to io::Result<pid_t>, which is more idiomatic.
Replace all nix APIs with rustix equivalents in the security-critical
TOCTOU-safe filesystem traversal module:
- nix::dir::Dir -> rustix::fs::Dir (uses Dir::read_from which borrows fd)
- nix::fcntl::{OFlag, openat} -> rustix::fs::{OFlags, openat}
- nix::sys::stat::{fstat, fstatat, fchmod, fchmodat, mkdirat} -> rustix::fs
- nix::unistd::{fchown, fchownat, unlinkat} -> rustix::fs
- FchmodatFlags/UnlinkatFlags -> rustix::fs::AtFlags
- Error handling simplified: rustix Errno implements Into<io::Error>
Also update rm's unix platform code to use the new Stat type.
All 31 safe_traversal unit tests pass.
Replace all nix signal and poll APIs in uucore: - signals.rs: nix::sys::signal -> csignal wrappers - signals.rs: nix::poll -> rustix::event::poll - signals.rs: nix::sys::stat -> rustix::fs::fstat + libc constants - lib.rs: nix sigaction -> csignal::set_signal_action - dd/progress.rs: update install_sigusr1_handler to use libc::SIGUSR1 Return types change from nix::Result/Errno to std::io::Result.
Migrate 19 utility crates from nix to rustix and direct libc calls: - kill, timeout, env: signal handling via csignal wrappers + libc - sync, cat, tail, dd, tsort: file operations via rustix::fs - touch: futimens via rustix::fs::futimens - stty, tty: terminal ops via rustix::termios + libc ioctl - sort: getrlimit via rustix::process, sysconf via libc - wc, cp, df: stat/fstat via rustix::fs - nice: priority via rustix::process - mkfifo, mknod: via direct libc calls Also add rustix::io::Errno conversions to uucore error.rs.
- Remove nix dependency from uucore Cargo.toml - Remove nix error conversion impls from error.rs, replace with rustix - Migrate date's clock_settime/clock_getres from nix to rustix::time - Replace nix dependency with rustix in date's Cargo.toml - Update test nix features for test utilities that still need it The nix crate is now completely removed from all source code (src/). It remains only as a dev-dependency for test code.
Contributor
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.