coreutils/src
mattsu ccd4bbdc8f
fix(sort): GNU sort-continue.sh test (#9107)
* feat: dynamically adjust merge batch size based on file descriptor limits

- Add `effective_merge_batch_size()` function to calculate batch size considering fd soft limit, with minimums and safety margins.
- Generalize fd limit handling from Linux-only to Unix systems using `fd_soft_limit()`.
- Update merge logic to use dynamic batch size instead of fixed `settings.merge_batch_size` to prevent fd exhaustion.

* fix(sort): update rlimit fetching to use fd_soft_limit with error handling

Replace direct call to get_rlimit()? with fd_soft_limit(), adding a check for None value to return a usage error if rlimit cannot be fetched. This improves robustness on Linux by ensuring proper error handling when retrieving the file descriptor soft limit.

* refactor(sort): restrict nix::libc and fd_soft_limit to Linux

Update conditional compilation attributes from #[cfg(unix)] to #[cfg(target_os = "linux")]
for the nix::libc import and fd_soft_limit function implementations, ensuring these
features are only enabled on Linux systems to improve portability and avoid issues
on other Unix-like platforms.

* refactor: improve thread management and replace unsafe libc calls

Replace unsafe libc::getrlimit calls in fd_soft_limit with safe nix crate usage.
Update Rayon thread configuration to use ThreadPoolBuilder instead of environment variables for better control.
Add documentation comment to effective_merge_batch_size function for clarity.

* refactor(linux): improve error handling in fd_soft_limit function

Extract the rlimit fetching logic into a separate `get_rlimit` function that returns `UResult<usize>` and properly handles errors with `UUsageError`, instead of silently returning `None` on failure or infinity. This provides better error reporting for resource limit issues on Linux platforms.

* refactor(sort): reorder imports in get_rlimit for consistency

Reordered the nix::sys::resource imports to group constants first (RLIM_INFINITY), then types (Resource), and finally functions (getrlimit), improving code readability and adhering to import style guidelines.
2025-12-20 09:35:53 +01:00
..
bin Merge pull request #9584 from dgilman/main 2025-12-08 09:24:45 +01:00
common Merge pull request #9589 from oech3/patch-7 2025-12-07 14:23:59 +01:00
uu fix(sort): GNU sort-continue.sh test (#9107) 2025-12-20 09:35:53 +01:00
uucore Merge pull request #9693 from sylvestre/printf 2025-12-19 08:33:58 +01:00
uucore_procs Fix the doc generation and remove uuhelp_parser 2025-09-11 21:30:33 +02:00
lib.rs uudoc: move manpage generation away from the binary 2025-10-22 01:17:08 -07:00