Commit graph

4332 commits

Author SHA1 Message Date
Adrian Kretz
ce90685e8a test/chown: use wheel group on BSD 2025-10-27 19:35:31 +01:00
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
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
Sylvestre Ledru
b17129d8ee date: add ignored tests that passes with GNU and fails with Rust 2025-10-27 10:02:35 +01:00
Dorian Peron
3d8ad59b30 test(cksum): Add sha3 tests 2025-10-26 20:18:14 +01:00
Dorian Peron
87f61423af test(cksum): Add sha2 tests 2025-10-26 20:18:14 +01:00
Dorian Peron
7aa46dd9c7 test(cksum): nits on tests 2025-10-26 20:18:14 +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
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
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
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
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
Christopher Armstrong
1c0214b29d du: ignore env zero blocksize 2025-10-20 07:26:32 -04:00
Daniel Hofstetter
14ba196a79 Cargo.toml: remove "test_unimplemented" feature 2025-10-19 11:41:14 +02: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
Sylvestre Ledru
db9c50c327
Merge pull request #8941 from cakebaker/od_small_refactorings
od: fix incomplete test & apply small refactorings to tests
2025-10-17 17:07:56 +02:00
Daniel Hofstetter
56aad28b0e od: apply small refactorings to tests 2025-10-17 16:33:49 +02: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
Daniel Hofstetter
20775fd6a9 od: fix incomplete test 2025-10-17 15:48:59 +02:00
Christopher Armstrong
6015c8fa31 df: treat env var with zero block size as invalid 2025-10-17 09:32:37 -04: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
b1afe3499a fix tests/od/od-N 2025-10-16 06:13:45 -04:00
alexander
6e422b728e
df: add tracing zero and rounding (#8685)
Some checks failed
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 / Separate Builds (push) Waiting to run
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
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/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
Check uudoc Documentation Generation / Verify uudoc generates correct documentation (push) Has been cancelled
2025-10-15 22:11:44 -04:00
alexander
517b5fb8b3
hostname: fix -d flag (#8657)
* hostname: fix -d flag

* tests/hostname: test -d when no domain
2025-10-15 22:07:54 -04:00
Cả thế giới là Rust
af766713c5
test(nohup): improve coverage for fd replacement and error paths (#8920)
* test(nohup): expand test coverage for fd replacement and error paths

Add comprehensive tests for nohup's file descriptor replacement logic
and error handling, increasing coverage of previously untested code paths.

New tests cover:
- Creating nohup.out in current directory
- Appending to existing nohup.out
- Stderr redirection to stdout
- Command not found error (exit codes 126/127)
- Fallback to $HOME/nohup.out when cwd is not writable (Linux/FreeBSD)
- POSIXLY_CORRECT environment variable handling (Linux/FreeBSD)

Tests use .terminal_simulation(true) to properly test TTY-dependent
behavior. Platform-specific tests are gated behind appropriate cfg
attributes.

Addresses #1857

* fix: CI failures for cspell and clippy in nohup tests

- Add 'nowrite' to cspell jargon dictionary
- Fix clippy::uninlined_format_args warnings in test_nohup.rs
- Remove nested #[test] function that caused unnameable-test-items error
- Format strings now use inline variable syntax
2025-10-15 21:39:19 -04:00
Cả thế giới là Rust
88bc1c5fc3
Merge pull request #8911 from naoNao89/fix-dirname-trailing-dot
Fix dirname handling of paths ending in `/.`
2025-10-15 20:19:14 -04:00
Christopher Armstrong
37d00ae89b cp: display symlink creation with --verbose
cp: display removed files with --verbose
2025-10-15 22:30:27 +01:00
Sylvestre Ledru
e2e5c76a7c
Merge pull request #8907 from naoNao89/fix/date-numeric-d-parsing
Some checks failed
CICD / MinRustV (push) Has been cancelled
CICD / Separate Builds (push) Has been cancelled
CICD / Dependencies (push) Has been cancelled
CICD / Code Coverage (push) Has been cancelled
Android / Test builds (push) Has been cancelled
GnuTests / Run GNU tests (native) (push) Has been cancelled
GnuTests / Run GNU tests (SELinux) (push) Has been cancelled
Benchmarks / Run benchmarks (CodSpeed) (push) Has been cancelled
Code Quality / Style/format (push) Has been cancelled
Code Quality / Style/lint (push) Has been cancelled
Code Quality / Style/spelling (push) Has been cancelled
Code Quality / Style/toml (push) Has been cancelled
Code Quality / Style/Python (push) Has been cancelled
Code Quality / Pre-commit hooks (push) Has been cancelled
Devcontainer / Verify devcontainer (push) Has been cancelled
FreeBSD / Style and Lint (push) Has been cancelled
FreeBSD / Tests (push) Has been cancelled
WSL2 / Test (push) Has been cancelled
CICD / Binary sizes (push) Has been cancelled
CICD / Build (push) Has been cancelled
CICD / Test all features separately (push) Has been cancelled
CICD / Build/Makefile (push) Has been cancelled
CICD / Build/stable (push) Has been cancelled
CICD / Build/nightly (push) Has been cancelled
CICD / Tests/BusyBox test suite (push) Has been cancelled
CICD / Tests/Toybox test suite (push) Has been cancelled
CICD / Safe Traversal Security Check (push) Has been cancelled
CICD / Build/SELinux (push) Has been cancelled
CICD / Build/SELinux-Stubs (Non-Linux) (push) Has been cancelled
GnuTests / Aggregate GNU test results (push) Has been cancelled
date: follow GNU pure-number -d semantics
2025-10-14 12:29:29 +02:00
Daniel Hofstetter
58f32648d7
Merge pull request #8900 from Alonely0/clippy
chore: huge clippy pass ahead of 1.92.0 release
2025-10-14 10:45:47 +02:00
naoNao89
0047c7e66f fix(date): align pure-digit -d parsing with GNU semantics
Implement GNU 'Pure numbers in date strings' for time-of-day tokens:
- 1–2 digits => HH:00 today
- 3–4 digits => HHMM today
- Validate ranges; reject invalid times (e.g., 2400, 2360)

Also:
- Add tests for -d0, -d7, -d0700 under TZ=UTC0 and invalid numeric inputs
- Reference GNU manual section for pure numbers
2025-10-14 11:42:38 +07:00
Andrew Gaul
5274576311 Include subsecond precision in stat atime/ctime
Previously only mtime supported this.  Follows on to
1d0dcb5962.  References #3233.
References s3fs-fuse/s3fs-fuse#2740.
2025-10-13 10:54:42 -07:00
Guillem L. Jara
3a77bf40b8 chore: huge clippy pass ahead of 1.92.0 release 2025-10-13 18:06:35 +02:00
Cả thế giới là Rust
16af7d4f9a
ls: Implement -f flag to disable sorting and enable -a (#8824)
* ls: implement -f flag with correct constant, color logic, and localization

Fix the -f flag implementation to properly enable all files display,
disable sorting, and handle color output correctly.

Changes:
- Correct UNSORTED_ALL constant from 'unsorted-all' to 'f'
- Fix color logic to honor explicit --color flag regardless of -f position
- Add French localization for ls-help-unsorted-all
- Add comprehensive integration tests for -f flag behavior

The explicit --color flag now always takes precedence over -f implicit
color disabling, matching expected CLI behavior.

* tests(ls): improve -f flag test assertions

Address maintainer feedback from PR #8824 review:

1. test_f_flag_disables_sorting: Compare -f output with -a (sorted) and -U (unsorted)
   to prove sorting is actually disabled, not just that files appear in output

2. test_f_overrides_big_a: Rename from test_f_overrides_a_and_big_a and fix assertions
   to check for .. presence (distinguishes -f from -A) instead of .hidden (shown in both)

3. test_f_overrides_sort_flags: Use size-based files and explicit output comparisons
   to verify last-flag-wins behavior with deterministic ordering

4. test_big_u_overrides_f_sort: Use size-based files and verify -U participates
   in last-flag-wins by checking actual output order

All tests now properly validate flag interactions instead of just checking file presence.

* refactor(ls): use match expression in extract_sort

Replace if/else chain with match expression for improved readability
and more idiomatic Rust code. Uses match guards for index comparisons.

Addresses maintainer feedback from PR #8824 review.

No functional changes - behavior remains identical.

* fix(ls): use snake_case for test variable names

Follow Rust naming conventions by converting variable names in -f flag
tests from mixed case (out_Af, out_fS, etc.) to snake_case (out_a_f,
out_f_s, etc.). This eliminates clippy warnings about non_snake_case
identifiers.

* tests: fix flaky ls tests that depend on filesystem directory order

The tests test_f_flag_disables_sorting, test_big_u_overrides_f_sort, and
test_f_overrides_sort_flags made incorrect assumptions that unsorted
directory order would always differ from sorted order. However,
fs::read_dir() returns entries in filesystem-dependent order which may
accidentally match sorted order on some filesystems.

Changes:
- Removed assertions comparing unsorted vs sorted outputs
- Added deterministic checks (e.g., verifying --sort after -f works)
- Added explicit order verification for size-sorted outputs
- Tests now verify flag precedence without relying on directory order

Fixes CI failures on Windows and SELinux platforms.

Quality checks passed:
- cargo fmt --check: ✓
- cargo clippy --test tests: ✓
- all 3 modified tests pass: ✓

* test: fix misleading test name for -U flag behavior

Renamed test_big_u_overrides_f_sort to test_big_u_participates_in_sort_flag_wins
to accurately reflect that it tests -U with -S interactions, not -f.
2025-10-13 09:42:25 +02:00
Ahmed hossam
d79c18a693
Merge pull request #8791 from dekuu5/stat/fix-symlink-behavior
Some checks are pending
CICD / MinRustV (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 / Separate Builds (push) Waiting to run
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
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/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
stat: fix %N symlink to be single quote instead of double quote
2025-10-12 18:40:54 +02:00
Sylvestre Ledru
78667275e6
Merge pull request #8746 from jacob-greenfield/sort-fix-buffer-read
sort: fix newline handling across large and/or multiple files
2025-10-11 18:37:36 +02:00
Christopher Ada Armstrong
7e12383fcf
cp: show relative path of source file with -vr (#8887)
* cp: show relative path of source file with -vr

Add test to cover fix.

* fix test expected output for windows
2025-10-11 17:30:19 +02:00