- 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.
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.
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 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.
* cksum: fix parsing error with tagged cheksum files
When passed the '-c'/'--check' flag, and parsing a checksum file in
the "tagged" format, cksum (symlinked to sha256sum, etc...) expects a
line that looks like this:
ShA256 (file.bin) = da39a3ee5e6b4b0d3255bfef95601890afd80709
If the hash algorithm at the beginning of the line (in the above case
SHA256) is missing, then cksum panics because it is attempts to use the
value of an array at index -1. This fix causes cksum to instead consider
the line a syntax error and ignore it, just as GNU cksum does. I also
added unit and integration tests to check for the above behaviour.
---------
Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>