Commit graph

9099 commits

Author SHA1 Message Date
Daniel Hofstetter
870bc29cb4
Merge pull request #9022 from sylvestre/test-ignored-date
date: improve compat with GNU
2025-10-27 11:40:01 +01:00
Sylvestre Ledru
0be1ac88c4
Merge pull request #9035 from RenjiSann/cksum-fix-sha2-sha3
Some checks failed
Check uudoc Documentation Generation / Verify uudoc generates correct documentation (push) Has been cancelled
CICD / Separate Builds (push) Waiting to run
CICD / Dependencies (push) Waiting to run
CICD / Build/Makefile (push) Blocked by required conditions
CICD / Build/stable (push) Blocked by required conditions
CICD / Build/nightly (push) Blocked by required conditions
CICD / Binary sizes (push) Blocked by required conditions
CICD / Build (push) Blocked by required conditions
CICD / Tests/BusyBox test suite (push) Blocked by required conditions
CICD / Code Coverage (push) Waiting to run
CICD / Tests/Toybox test suite (push) Blocked by required conditions
CICD / Safe Traversal Security Check (push) Blocked by required conditions
CICD / Build/SELinux-Stubs (Non-Linux) (push) Blocked by required conditions
GnuTests / Run GNU tests (SELinux) (push) Waiting to run
CICD / Test all features separately (push) Blocked by required conditions
CICD / Build/SELinux (push) Blocked by required conditions
GnuTests / Run GNU tests (native) (push) Waiting to run
GnuTests / Aggregate GNU test results (push) Blocked by required conditions
Android / Test builds (push) Waiting to run
Benchmarks / Run benchmarks (CodSpeed) (push) Waiting to run
Code Quality / Style/format (push) Waiting to run
Code Quality / Style/lint (push) Waiting to run
Code Quality / Style/spelling (push) Waiting to run
Code Quality / Style/toml (push) Waiting to run
Code Quality / Style/Python (push) Waiting to run
Code Quality / Pre-commit hooks (push) Waiting to run
Devcontainer / Verify devcontainer (push) Waiting to run
FreeBSD / Style and Lint (push) Waiting to run
FreeBSD / Tests (push) Waiting to run
WSL2 / Test (push) Waiting to run
cksum: Add support for sha2, sha3
2025-10-27 10:59:27 +01:00
Sylvestre Ledru
d87a5b88a3 date: support(Military timezone with optional hour offset 2025-10-27 10:31:01 +01:00
Sylvestre Ledru
5cae9ae53e date: -d empty string should be treated as midnight today 2025-10-27 10:31:01 +01:00
Sylvestre Ledru
284554658d date: add support for the 'J' military timezone 2025-10-27 10:30:43 +01:00
n4n5
85c92f2684
cut,touch: show ignored args (#9040) 2025-10-27 08:32:01 +01:00
n4n5
cbe20c9bff
date: make --utc alias visible (#9041) 2025-10-27 08:12:54 +01:00
Sylvestre Ledru
c2488a474e Fix spell-checker directive for IST timezone entry 2025-10-26 22:09:02 +01:00
Sylvestre Ledru
b818481e5f date: fix parse_datetime 0.13 API compatibility issues 2025-10-26 22:09:02 +01:00
naoNao89
f764be8ddf touch: fix parse_datetime 0.13 API usage for deterministic relative dates
The previous implementation incorrectly used parse_datetime() instead of
parse_datetime_at_date(), causing relative date strings like 'yesterday' or
'2 days ago' to be calculated from the current system time instead of the
caller-specified reference time.

This fix:
- Uses parse_datetime_at_date() with proper chrono->jiff->chrono conversions
- Restores deterministic behavior for relative date parsing
- Adds jiff 0.2.15 as direct dependency (not workspace) to avoid feature conflicts
- Ensures tests/touch/relative passes in CI

Note on jiff dependency:
parse_datetime 0.13 depends on jiff ^0.2.15 with specific features. Adding jiff
via workspace dependency causes feature unification conflicts across platforms.
Using a direct dependency with version 0.2.15 resolves this while maintaining
compatibility with parse_datetime's requirements.
2025-10-26 22:09:02 +01:00
naoNao89
f4b66479f0 date, touch: adapt to parse_datetime 0.13.0 API changes
Fixes #8754

parse_datetime 0.13.0 fixes the bug where parsing large second values
like "12345.123456789 seconds ago" would fail with "invalid date".

However, parse_datetime 0.13.0 introduced a breaking API change:
- Old (0.11.0): Returns chrono::DateTime
- New (0.13.0): Returns jiff::Zoned

This commit adapts both date and touch utilities to work with the new API:

date.rs changes:
- Simplified parse_date() to directly return jiff::Zoned
- Removed unnecessary chrono -> jiff conversion code
- parse_datetime now returns the exact type date utility uses
- Added detailed comments explaining the API change and issue #8754

touch.rs changes:
- Added jiff::Zoned -> chrono::DateTime conversion in parse_date()
- Changed from parse_datetime_at_date to parse_datetime
- Marked ref_time parameter as unused (preserved for future use)
- Added detailed comments about API change and future migration path

Note: 3 integration tests fail due to timezone handling changes in
parse_datetime 0.13. These are separate issues that will be addressed
in follow-up commits.
2025-10-26 22:09:02 +01:00
Dorian Peron
dfda5e0d91 util(cksum): Add support for sha2 and sha3 2025-10-26 20:18:14 +01:00
Daniel Hofstetter
a00d3478e3
Merge pull request #9032 from RenjiSann/cksum-fix-len-zero
Fix "cksum: --length 0 shouldn't fail for algorithms that don't support --length"
2025-10-26 16:39:52 +01:00
Daniel Hofstetter
28bc57a589
Merge pull request #9030 from sylvestre/remove-bench
bench: remove 'sort_random_strings'
2025-10-26 14:45:44 +01:00
Dorian Peron
4e9d07e86c util(cksum): Fix unexpected fail when giving --length 0 to wrong algorithm 2025-10-26 14:32:20 +01:00
Christopher Ada Armstrong
f7e639f8a2
Merge pull request #8930 from Ada-Armstrong/hashsum_continue_on_dirs
hashsum: don't fail on dirs
2025-10-26 14:25:00 +01:00
Cả thế giới là Rust
fd83181ac2
Fix EINTR handling in cat, od, and comm (#8946)
* fix: handle EINTR (signal interruptions) in cat, od, and comm

Add proper retry loops for ErrorKind::Interrupted in I/O operations
to handle signals like SIGUSR1 that can interrupt read/write calls.

This pattern is proven in production - identical to PR #6025 (merged
March 2024) which fixed dd's EINTR handling for GNU test dd/stats.sh.
The same pattern is already used in 9+ utilities (head, tail, tee, wc,
sort, sum, tr, shuf, dd) without issues.

Changes:
- cat: Fix write_fast() and write_lines() to retry on EINTR
- od: Fix PartialReader::read() in all three read paths
- comm: Fix are_files_identical() for both file readers
- tests: Add InterruptingReader/Writer test utilities

Historical context:
- Pattern validated by cre4ture's PR #6025 (dd EINTR fix)
- Matches existing implementations in dd/dd.rs:450,881
- POSIX best practice for signal-interrupted I/O

Fixes #1275

* fix: handle EINTR (signal interruptions) in cat, od, and comm

Add proper retry loops for ErrorKind::Interrupted in I/O operations to handle signals like SIGUSR1 that can interrupt read/write calls.

Pattern matches PR #6025 (dd EINTR fix) and is already used in 9+ utilities. Changes:
- cat: Fix write_fast() and write_lines() to retry on EINTR
- od: Fix PartialReader::read() in all three read paths
- comm: Fix are_files_identical() for both file readers
- tests: Add visible EINTR integration tests for CI

Addresses sylvestre's review feedback on code documentation and CI test visibility.

* style: apply cargo fmt formatting to EINTR changes

* test: fix EINTR integration test failures

- Fix comm test: use stdout_contains instead of stdout_only for tabbed output
- Fix od test: create new command instance to avoid 'already run this UCommand' error
- Remove unused imports and dead code to eliminate compiler warnings
- Both tests now pass without warnings or errors

* style: fix formatting and remove duplicate comment in od test

* ci: add EINTR and related technical terms to appropriate cspell dictionaries

- Add EINTR, eintr, nextest to jargon.wordlist.txt (technical/systems programming terms)
- Add SIGUSR, SIGINT, etc. to shell.wordlist.txt (POSIX signals)
- Add uutils, coreutils, ucmd, etc. to workspace.wordlist.txt (project-specific terms)
- Fixes CI cspell warnings for legitimate technical terminology
- Proper categorization follows existing dictionary structure
2025-10-26 13:59:47 +01:00
Sylvestre Ledru
d26ff9761b bench: remove 'sort_random_strings' 2025-10-26 13:53:28 +01:00
Sylvestre Ledru
aa172ae7df
Merge pull request #8944 from naoNao89/fix/issue-1882-date-set-formats
fix(date): support timezone abbreviations in date --set`
2025-10-26 12:41:14 +01:00
Sylvestre Ledru
82464a4259
Merge pull request #9024 from RenjiSann/checksum-updates
cksum: Refactor cksum for incoming merge with hashsum, Fix behavior for `--text` and `--untagged`
2025-10-26 12:31:22 +01:00
Dorian Peron
a4f4542467 util(cksum): Fix behavior with --text and --untagged, and prepare hashsum/cksum merge refactor 2025-10-26 12:06:12 +01:00
Dorian Peron
485fd8e207 util(cksum): Fix non-idiomatic comments 2025-10-26 00:52:18 +02:00
Dorian Peron
0e1be59676 util(cksum): Avoid collecting a file vector preemptively 2025-10-26 00:52:18 +02:00
mattsu
a452d86a3a
Improve sort buffer sizing heuristics and honor explicit --buffer-size (#8833)
Some checks are pending
CICD / MinRustV (push) Waiting to run
CICD / Separate Builds (push) Waiting to run
CICD / Dependencies (push) Waiting to run
CICD / Build/Makefile (push) Blocked by required conditions
CICD / Build/stable (push) Blocked by required conditions
CICD / Build/nightly (push) Blocked by required conditions
CICD / Binary sizes (push) Blocked by required conditions
CICD / Build (push) Blocked by required conditions
CICD / Tests/Toybox test suite (push) Blocked by required conditions
CICD / Code Coverage (push) Waiting to run
CICD / Safe Traversal Security Check (push) Blocked by required conditions
CICD / Test all features separately (push) Blocked by required conditions
CICD / Build/SELinux (push) Blocked by required conditions
CICD / Build/SELinux-Stubs (Non-Linux) (push) Blocked by required conditions
GnuTests / Run GNU tests (native) (push) Waiting to run
GnuTests / Run GNU tests (SELinux) (push) Waiting to run
CICD / Tests/BusyBox test suite (push) Blocked by required conditions
Android / Test builds (push) Waiting to run
GnuTests / Aggregate GNU test results (push) Blocked by required conditions
Benchmarks / Run benchmarks (CodSpeed) (push) Waiting to run
Code Quality / Style/Python (push) Waiting to run
Code Quality / Style/format (push) Waiting to run
Code Quality / Style/lint (push) Waiting to run
Code Quality / Style/spelling (push) Waiting to run
Code Quality / Style/toml (push) Waiting to run
Code Quality / Pre-commit hooks (push) Waiting to run
Devcontainer / Verify devcontainer (push) Waiting to run
FreeBSD / Style and Lint (push) Waiting to run
FreeBSD / Tests (push) Waiting to run
WSL2 / Test (push) Waiting to run
* feat(sort): add adaptive buffer sizing and fast paths

- move heuristics into a new buffer_hint module and default to automatic sizing when the buffer flag is absent

- tune chunk and external sort buffers to avoid runaway allocations

- add fast lexicographic and ASCII case-insensitive comparisons for the default mode

- refresh spell-check and dependency metadata for the new code

* fix(sort): reuse SIGINT handler for temporary directory cleanup

- keep the latest path/lock pair in a shared registry so SIGINT always cleans the active directory

- guard handler installation with an atomic flag and reset state when the wrapper is dropped

* refactor(sort): simplify merge batch size to fixed value

Remove Linux-specific dynamic adjustment based on file descriptors and use a fixed batch size of 64 for consistency across platforms.

* fix Cargo.lock linux environments
2025-10-25 00:12:42 +02:00
David CARLIER
01c0a61001
clippy: fix warnings from nightly (#8991)
Some checks are pending
CICD / MinRustV (push) Waiting to run
CICD / Separate Builds (push) Waiting to run
CICD / Dependencies (push) Waiting to run
CICD / Build/Makefile (push) Blocked by required conditions
CICD / Build/stable (push) Blocked by required conditions
CICD / Build/nightly (push) Blocked by required conditions
CICD / Binary sizes (push) Blocked by required conditions
CICD / Build (push) Blocked by required conditions
CICD / Tests/BusyBox test suite (push) Blocked by required conditions
CICD / Tests/Toybox test suite (push) Blocked by required conditions
CICD / Code Coverage (push) Waiting to run
CICD / Safe Traversal Security Check (push) Blocked by required conditions
CICD / Test all features separately (push) Blocked by required conditions
CICD / Build/SELinux (push) Blocked by required conditions
CICD / Build/SELinux-Stubs (Non-Linux) (push) Blocked by required conditions
GnuTests / Run GNU tests (native) (push) Waiting to run
GnuTests / Run GNU tests (SELinux) (push) Waiting to run
GnuTests / Aggregate GNU test results (push) Blocked by required conditions
Android / Test builds (push) Waiting to run
Benchmarks / Run benchmarks (CodSpeed) (push) Waiting to run
Code Quality / Style/Python (push) Waiting to run
Code Quality / Style/format (push) Waiting to run
Code Quality / Style/lint (push) Waiting to run
Code Quality / Style/spelling (push) Waiting to run
Code Quality / Pre-commit hooks (push) Waiting to run
Code Quality / Style/toml (push) Waiting to run
Devcontainer / Verify devcontainer (push) Waiting to run
FreeBSD / Style and Lint (push) Waiting to run
FreeBSD / Tests (push) Waiting to run
WSL2 / Test (push) Waiting to run
* uu: addressing clippy warning, find_kp_breakpoints modernize while loop.

* however here clippy advice do not seem a gain.

yes we can vave Box::new but then we have to clone the chunk..

* feedback, remove also too recent clippy annotation
2025-10-24 11:44:11 +02:00
Sylvestre Ledru
8867591716 mv: improve the verbose mode to make tests/mv/mv-special-1.sh pass 2025-10-24 00:00:21 +02:00
mattsu
909da50371
Merge pull request #8959 from mattsu2020/sort-memory-functions
Some checks are pending
CICD / Documentation/warnings (push) Waiting to run
CICD / MinRustV (push) Waiting to run
CICD / Build/Makefile (push) Blocked by required conditions
CICD / Build/nightly (push) Blocked by required conditions
CICD / Binary sizes (push) Blocked by required conditions
CICD / Build (push) Blocked by required conditions
CICD / Tests/BusyBox test suite (push) Blocked by required conditions
CICD / Build/stable (push) Blocked by required conditions
CICD / Tests/Toybox test suite (push) Blocked by required conditions
CICD / Code Coverage (push) Waiting to run
CICD / Separate Builds (push) Waiting to run
CICD / Test all features separately (push) Blocked by required conditions
CICD / Build/SELinux-Stubs (Non-Linux) (push) Blocked by required conditions
CICD / Build/SELinux (push) Blocked by required conditions
CICD / Safe Traversal Security Check (push) Blocked by required conditions
GnuTests / Run GNU tests (native) (push) Waiting to run
GnuTests / Run GNU tests (SELinux) (push) Waiting to run
GnuTests / Aggregate GNU test results (push) Blocked by required conditions
Android / Test builds (push) Waiting to run
Benchmarks / Run benchmarks (CodSpeed) (push) Waiting to run
Code Quality / Style/Python (push) Waiting to run
Code Quality / Style/format (push) Waiting to run
Code Quality / Style/lint (push) Waiting to run
Code Quality / Style/spelling (push) Waiting to run
Code Quality / Style/toml (push) Waiting to run
Code Quality / Pre-commit hooks (push) Waiting to run
Devcontainer / Verify devcontainer (push) Waiting to run
FreeBSD / Style and Lint (push) Waiting to run
FreeBSD / Tests (push) Waiting to run
WSL2 / Test (push) Waiting to run
feat(sort): auto-tune buffer sizing from available memory
2025-10-23 11:53:19 +02:00
Sylvestre Ledru
3d6b0b2ea4
--version should just print the command name, not the path (#8921)
Some checks are pending
CICD / MinRustV (push) Waiting to run
CICD / Separate Builds (push) Waiting to run
CICD / Build/Makefile (push) Blocked by required conditions
CICD / Dependencies (push) Waiting to run
CICD / Binary sizes (push) Blocked by required conditions
CICD / Build (push) Blocked by required conditions
CICD / Build/stable (push) Blocked by required conditions
CICD / Build/nightly (push) Blocked by required conditions
CICD / Tests/BusyBox test suite (push) Blocked by required conditions
CICD / Tests/Toybox test suite (push) Blocked by required conditions
CICD / Code Coverage (push) Waiting to run
CICD / Safe Traversal Security Check (push) Blocked by required conditions
CICD / Build/SELinux (push) Blocked by required conditions
CICD / Build/SELinux-Stubs (Non-Linux) (push) Blocked by required conditions
GnuTests / Run GNU tests (native) (push) Waiting to run
GnuTests / Aggregate GNU test results (push) Blocked by required conditions
Android / Test builds (push) Waiting to run
Code Quality / Style/spelling (push) Waiting to run
Code Quality / Style/toml (push) Waiting to run
Code Quality / Style/Python (push) Waiting to run
Code Quality / Pre-commit hooks (push) Waiting to run
Devcontainer / Verify devcontainer (push) Waiting to run
FreeBSD / Style and Lint (push) Waiting to run
FreeBSD / Tests (push) Waiting to run
CICD / Test all features separately (push) Blocked by required conditions
GnuTests / Run GNU tests (SELinux) (push) Waiting to run
Benchmarks / Run benchmarks (CodSpeed) (push) Waiting to run
Code Quality / Style/format (push) Waiting to run
Code Quality / Style/lint (push) Waiting to run
WSL2 / Test (push) Waiting to run
* --version should just print the command name, not the path

This will fix the parsing for old autoconf
Closes: #8880

* Update tests/by-util/test_mkdir.rs

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2025-10-23 10:23:51 +02:00
Daniel Hofstetter
e2634e5c48
Merge pull request #8567 from sylvestre/rm-progress
rm: add the --progress option like with cp & mv
2025-10-22 11:14:14 +02:00
Sylvestre Ledru
94e10238c5
Merge pull request #8513 from aaron-ang/migrate-manpage
uudoc: move manpage and completions generation out of binary
2025-10-22 11:02:12 +02:00
Aaron Ang
2919027841 uudoc: move manpage generation away from the binary 2025-10-22 01:17:08 -07:00
Sylvestre Ledru
8bf15fe676 rm: add the --progress option like with cp & mv 2025-10-22 00:27:49 +02:00
Sylvestre Ledru
2434c2ae13 Install: implement -Z
Fixes: tests/install/install-Z-selinux
2025-10-21 23:27:06 +02:00
mattsu
9aa1055196
fix procfs dependencies (#8968) 2025-10-21 09:15:39 +02:00
Vrishabh
d5bc7803e4
Merge pull request #8869 from psvri/improve_hashsum
hashsum: improve hashsum using 32KiB bufreader - windows perfs
2025-10-20 20:57:47 +02:00
Christopher Armstrong
1c0214b29d du: ignore env zero blocksize 2025-10-20 07:26:32 -04:00
mattsu
7c9c481612
Merge branch 'uutils:main' into uucore-memory 2025-10-18 21:04:23 +09:00
mattsu
12c43fd4b5 refactor(uucore): integrate procfs for Linux memory parsing 2025-10-18 21:00:43 +09:00
naoNao89
16b386537f chore: silence cspell for timezone abbreviations (AWST, ACST, ACDT, Kolkata, tzdb) 2025-10-18 03:49:11 +07:00
naoNao89
49c3386d19 fix(date): add timezone abbreviation support for date --set
Fixes #1882

Implements dynamic timezone abbreviation resolution with minimal hardcoding:
- Dynamically discovers 588+ IANA timezones and their abbreviations
- Only 11 hardcoded disambiguations for truly ambiguous cases (CST, EST, IST, etc.)
- US timezone preferences for GNU compatibility
- Comprehensive test coverage including Australian, Asian, European, and US timezones

All date --set formats now work correctly.
2025-10-18 03:13:42 +07:00
Zackary Ayoun
3ff51d6402 ls: fix zero block size handling to match GNU ls
- Reject --block-size=0 with "invalid --block-size argument '0'" error
  using parse_size_non_zero_u64
- Add test coverage for both command-line and env var cases

Matches GNU ls behavior where command-line zero is invalid but
environment variable zero is silently ignored.
2025-10-17 16:18:48 +00:00
Daniel Hofstetter
1263ba20be
Merge pull request #8932 from Ada-Armstrong/df_env_var_zero_block_size
df: treat env var with zero block size same as invalid
2025-10-17 16:16:48 +02:00
Christopher Armstrong
6015c8fa31 df: treat env var with zero block size as invalid 2025-10-17 09:32:37 -04:00
Christopher Armstrong
3ec3849739 uucore: add parse_size_non_zero_u64 which fails parsing 0 2025-10-17 09:29:56 -04:00
Sylvestre Ledru
a255a1f3db
Merge pull request #8939 from naoNao89/fix/sort-benchmark-variance
Some checks failed
CICD / Separate Builds (push) Waiting to run
CICD / Dependencies (push) Waiting to run
CICD / Build/Makefile (push) Blocked by required conditions
CICD / Build/stable (push) Blocked by required conditions
CICD / Build/nightly (push) Blocked by required conditions
CICD / Binary sizes (push) Blocked by required conditions
CICD / Build (push) Blocked by required conditions
CICD / Tests/BusyBox test suite (push) Blocked by required conditions
CICD / Tests/Toybox test suite (push) Blocked by required conditions
CICD / Code Coverage (push) Waiting to run
CICD / Safe Traversal Security Check (push) Blocked by required conditions
CICD / Test all features separately (push) Blocked by required conditions
CICD / Build/SELinux (push) Blocked by required conditions
CICD / Build/SELinux-Stubs (Non-Linux) (push) Blocked by required conditions
GnuTests / Aggregate GNU test results (push) Blocked by required conditions
Android / Test builds (push) Waiting to run
Benchmarks / Run benchmarks (CodSpeed) (push) Waiting to run
FreeBSD / Style and Lint (push) Waiting to run
GnuTests / Run GNU tests (native) (push) Waiting to run
GnuTests / Run GNU tests (SELinux) (push) Waiting to run
Code Quality / Style/format (push) Waiting to run
Code Quality / Style/lint (push) Waiting to run
Code Quality / Style/spelling (push) Waiting to run
Code Quality / Style/toml (push) Waiting to run
Code Quality / Style/Python (push) Waiting to run
Code Quality / Pre-commit hooks (push) Waiting to run
Devcontainer / Verify devcontainer (push) Waiting to run
FreeBSD / Tests (push) Waiting to run
WSL2 / Test (push) Waiting to run
Check uudoc Documentation Generation / Verify uudoc generates correct documentation (push) Has been cancelled
Reduce variance in sort benchmarks by reusing temp file
2025-10-17 14:56:48 +02:00
naoNao89
607383a2f9 bench(sort): reduce variance by reusing output files across iterations
Locale benchmarks were creating temp files inside the bench loop (from d1cd9998be), causing filesystem noise and false CodSpeed regressions. The same commit's sort_bench.rs got it right with file creation outside the loop. This fix aligns with that pattern.
2025-10-17 19:10:00 +07:00
Daniel Hofstetter
0258583aac
Merge pull request #8849 from sylvestre/od-n
od: add support for -S
2025-10-17 10:03:28 +02:00
Sylvestre Ledru
c1d9fc3c7d od: translate some strings 2025-10-16 06:13:54 -04:00
Sylvestre Ledru
fd75c37222 od: dedup some code 2025-10-16 06:13:45 -04:00
Sylvestre Ledru
b1afe3499a fix tests/od/od-N 2025-10-16 06:13:45 -04:00