Commit Graph

19163 Commits

Author SHA1 Message Date
Sylvestre Ledru 6a74110c59 refactor: add libc-based signal wrappers in uucore::signals::csignal
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.
2026-04-20 23:59:39 +02:00
Sylvestre Ledru 7ef9641eeb refactor: replace nix::libc re-exports with direct libc imports
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.
2026-04-20 23:59:39 +02:00
Sylvestre Ledru f1681b0a42 deps: add rustix as workspace dependency
Add rustix 1.1.4 with default-features = false to prepare for
migrating from nix to rustix for safer syscall bindings.
2026-04-20 23:59:39 +02:00
Josh French 0366d3c657 cksum: fix parsing error with tagged cheksum files (#11704)
* 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>
2026-04-20 23:51:01 +02:00
pre-commit-ci[bot] 6e9a8b8dab [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2026-04-20 23:49:21 +02:00
venoosoo da9513c4e0 docs: remove hashsum from compiles_table.csv 2026-04-20 23:49:21 +02:00
Daniel Hofstetter f2f3f7b117 unexpand: rename "uflag" to "utf8" 2026-04-20 23:36:24 +02:00
can1357 98f6b0187b tr: fix test to assert rejection of -ct with complemented class 2026-04-20 23:28:28 +02:00
can1357 85af4e8159 tr: fix complemented class truncation ordering 2026-04-20 23:28:28 +02:00
oech3 c48b5fe3c9 wc: avoid pipe() if input is pipe 2026-04-20 23:17:00 +02:00
xtqqczze 4011e6dae6 CI/SizeComment: enhance PR commenting logic to update existing comments 2026-04-20 23:14:55 +02:00
Ibrahim Burak Yorulmaz e5a6b519ad tests/dd: test supplying non-positive bs/ibs/cbs/obs 2026-04-20 23:12:56 +02:00
Ibrahim Burak Yorulmaz 4be5eb9f24 dd: exit when bs/ibs/obs/cbs isn't positive 2026-04-20 23:12:56 +02:00
oech3 36265cb9ee coreutils: --help args is same with --help 2026-04-20 23:05:29 +02:00
Daniel Hofstetter ef5243ea21 stty: add two missing baud rates (#11865) 2026-04-20 22:42:41 +02:00
Devel08 e4987f0dbd pr: exit with code 1 if --column argument is zero (#11750) 2026-04-20 22:41:53 +02:00
xtqqczze ab786f50ef wc: introduce IS_POSIXLY_CORRECT static (#11853) 2026-04-20 22:40:15 +02:00
oech3 dc18b54fb7 cat: call pipe() once with multiple input (#11699) 2026-04-20 22:36:15 +02:00
Aleksandar Janicijevic 6133ef5176 du: Allow command-line argument that appears more than once (#11897)
---------

Co-authored-by: Aleksandar Janicijevic <aleks@vogonsoft.com>
2026-04-20 22:34:11 +02:00
xtqqczze bd76e84ea2 refactor(tee): implement Copy for OutputErrorMode 2026-04-20 22:22:52 +02:00
xtqqczze a78f017cc4 tee: merge logic of flush into write
Co-authored-by: oech3 <79379754+oech3@users.noreply.github.com>
2026-04-20 22:22:52 +02:00
xtqqczze 5aa6c642d2 fix(tee): rename Error parameter in process_error 2026-04-20 22:22:52 +02:00
oech3 34fd4beac3 uucore: remove returned and unused usize 2026-04-20 17:13:49 +02:00
xtqqczze 0a0f222447 mv: use question_mark 2026-04-20 16:52:31 +02:00
xtqqczze c8813c8331 ls: simplify extraction of indices 2026-04-20 16:52:31 +02:00
oech3 742e8ca27f cp, uucore: remove unused returned u64 2026-04-20 15:52:06 +02:00
oech3 e50ddecd08 du: make du -a -s error 2026-04-20 15:05:13 +02:00
oech3 53384016c1 tee: reduce line of code 2026-04-20 09:55:27 +02:00
oech3 7254f8dfc9 tee: remove duplicated flush() 2026-04-20 09:16:16 +02:00
oech3 ec1fcdb4ac ls, stty: reduce cfg by target_vendor (#11910) 2026-04-20 08:36:32 +02:00
oech3 ab378e831f nohup: simplify cfg & use compile_error! 2026-04-20 08:28:44 +02:00
xtqqczze 4704caee08 clippy: lower array-size-threshold to ~64 KiB 2026-04-19 14:50:36 +02:00
xtqqczze 40070cadfc clippy: warn for large_stack_arrays lint
https://rust-lang.github.io/rust-clippy/rust-1.95.0/index.html#large_stack_arrays
2026-04-19 14:50:36 +02:00
oech3 e829cfb26c tee: move fn copy to MultiWriter & simplify 2026-04-19 14:28:37 +02:00
oech3 d5e84b4212 uniq: remove a collapsible_if 2026-04-19 13:50:07 +02:00
Lorenzo Rossi fbefc2bd99 tail: fix panic on write error in bounded_tail (#11886)
* 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>
2026-04-19 13:39:40 +02:00
oech3 09587d3706 realpath: remove collapsible_if 2026-04-19 13:27:21 +02:00
oech3 d3870d0989 rmdir: remove collapsible_if 2026-04-19 13:18:16 +02:00
oech3 e006be06d2 od: remove collapsible_if 2026-04-19 12:50:33 +02:00
oech3 f835fc484e join: remove collapsible_if 2026-04-19 11:43:31 +02:00
mattsu 01b7177f0b fix(sort): explicitly clean up temp directory in TmpDirWrapper::Drop
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
2026-04-18 20:16:56 +02:00
mattsu c1631da43f fix(sort): always install SIGINT handler to ensure temp dir cleanup
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
2026-04-18 20:16:13 +02:00
oech3 47c17df8b7 dd: remove collapsible_if 2026-04-18 14:17:27 +02:00
oech3 7d7ba48cc6 tail: remove collapsible_if 2026-04-18 14:10:10 +02:00
oech3 1c49059d51 cat: remove collapsible_if 2026-04-18 08:30:15 +02:00
oech3 f08652fcce head: remove collapsible_if 2026-04-18 08:08:26 +02:00
oech3 9a9c228300 split: remove collapsible_if 2026-04-18 07:50:00 +02:00
xtqqczze 26223adf5f panic.rs: use var_os 2026-04-17 16:05:42 +02:00
oech3 50ca60ad59 tee: remove collapsible_if 2026-04-17 15:11:14 +02:00
oech3 e1766b0903 tee: drop cfg for unsupported target 2026-04-17 14:55:44 +02:00