Skip to content

Rustix/uucore migration#11822

Draft
sylvestre wants to merge 7 commits intomainfrom
rustix/uucore-migration
Draft

Rustix/uucore migration#11822
sylvestre wants to merge 7 commits intomainfrom
rustix/uucore-migration

Conversation

@sylvestre
Copy link
Copy Markdown
Contributor

No description provided.

@oech3
Copy link
Copy Markdown
Contributor

oech3 commented Apr 15, 2026

sync previously failed GnuTests with rustix (raw-backend).

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.
@sylvestre sylvestre force-pushed the rustix/uucore-migration branch from 12500fe to 22ea466 Compare April 20, 2026 22:49
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 21, 2026

Merging this PR will degrade performance by 21.5%

❌ 9 regressed benchmarks
✅ 300 untouched benchmarks
⏩ 46 skipped benchmarks1

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation rm_recursive_tree 11.9 ms 12.9 ms -7.13%
Simulation wc_lines_large_line_count[500000] 2.6 ms 2.8 ms -6.5%
Simulation wc_lines_variable_length[(50, 500)] 3.2 ms 3.3 ms -5.32%
Simulation wc_lines_extreme_line_lengths[(100000, 200)] 1.4 ms 1.6 ms -11.78%
Simulation wc_chars_large_line_count[100000] 713.3 µs 908.7 µs -21.5%
Simulation du_max_depth_balanced_tree[(6, 4, 10)] 25.2 ms 27.4 ms -7.96%
Simulation du_wide_tree[(5000, 500)] 9.3 ms 9.9 ms -6.04%
Simulation du_all_wide_tree[(5000, 500)] 16.3 ms 16.9 ms -3.81%
Simulation du_summarize_balanced_tree[(5, 4, 10)] 6.6 ms 7.2 ms -7.49%

Comparing rustix/uucore-migration (22ea466) with main (0366d3c)

Open in CodSpeed

Footnotes

  1. 46 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@github-actions
Copy link
Copy Markdown

GNU testsuite comparison:

GNU test failed: tests/chmod/symlinks. tests/chmod/symlinks is passing on 'main'. Maybe you have to rebase?
GNU test failed: tests/misc/sync. tests/misc/sync is passing on 'main'. Maybe you have to rebase?
Skip an intermittent issue tests/pr/bounded-memory (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/rm/isatty (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/date/date-locale-hour (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/tail/symlink (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/tty/tty-eof (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/env/env-signal-handler is no longer failing!
Note: The gnu test tests/dd/nocache_fail is now being skipped but was previously passing.
Note: The gnu test tests/stty/bad-speed is now being skipped but was previously passing.
Congrats! The gnu test tests/cut/cut-huge-range is now passing!

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