Add a `csignal` module with thin libc-based wrappers for signal
operations that rustix does not cover: signal(), sigaction(),
sigprocmask(), SigSet, SigHandler, and SigmaskHow.
These wrappers will replace nix's signal module as part of the
nix-to-rustix migration.
Also add libc as a non-optional unix dependency for uucore.
Replace all `nix::libc::*` usages with direct `libc::*` imports
to decouple libc access from the nix crate, as preparation for
migrating from nix to rustix.
Add direct libc dependency to crates that previously relied on
nix's libc re-export: stty, env, sort, date, mknod, touch.
* 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>
* tail: fix panic on write error in bounded_tail
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* tail: increase test file size to ensure bounded_tail path
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
The `TmpDirWrapper::Drop` only cleared handler state without attempting
to delete the temporary directory. Cleanup relied entirely on the inner
`TempDir::Drop`, which silently ignores errors via `let _ =
remove_dir_all()`, potentially leaking `/tmp/uutils_sortXXXX`
directories.
Now `remove_tmp_dir` is called explicitly before `TempDir::Drop` runs,
providing a safety net for cases where the silent cleanup would fail.
Closes: #11728
The `should_install_signal_handler()` check added in 87c332c72 skipped
handler installation on systems with many open FDs, meaning Ctrl+C left
`/tmp/uutils_sortXXXX` directories behind with no cleanup at all.
Now the handler is always attempted; `ctrlc::set_handler` failing
naturally is sufficient. Failure is treated as non-fatal.
Closes: #11728