- 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.
* 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
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
* 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.
* fix(ln): enhance same-file detection with canonical paths
Improved the `link` function in `ln.rs` to use canonical path resolution for accurate same-file detection when forcing overwrites, preventing incorrect errors for equivalent paths. Added tests to verify behavior for self-linking and hard link relinking scenarios.
Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
In traditional mode (-G) with references enabled, `uutils/ptx` failed
to wrap long lines in the same way as the GNU `ptx` reference
implementation.
This was due to the layout algorithm operating on an incorrectly large
line width, as the space for the reference column was not being
subtracted from the total width budget.
This commit implements the correct line width adjustment by subtracting
the reference width. This aligns the wrapping behavior and
makes the output identical to GNU `ptx` for the tested cases.
* basenc: implement --base58 encoding option
Add support for Base58 encoding to basenc as per GNU coreutils 9.8.
Base58 uses the alphabet '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
which excludes visually ambiguous characters (0, O, I, l).
Resolves issue #8744.
* basenc: fix clippy warnings and spelling issues
Fix explicit iteration clippy warnings. Add Base58 alphabet to spell-checker ignore list to resolve cspell errors.
Add comprehensive test coverage for tee --output-error and broken pipe behavior:
- test_output_error_flag_without_value_defaults_warn_nopipe: Verify default behavior
- test_output_error_presence_only_broken_pipe_unix: Non-crash on SIGPIPE
- test_broken_pipe_early_termination_stdout_only: Early termination robustness
- test_write_failure_reports_error_and_nonzero_exit: Error reporting validation
These tests address remaining gaps from GNU test suite tests/misc/tee.sh and
tests/misc/write-errors.sh highlighted in #4627. Platform-specific guards
(#[cfg(unix)], FreeBSD exclusion) ensure cross-platform compatibility.
* tests(ls): Add GNU-compat TIME_STYLE tests (#4627)
Add comprehensive test coverage for ls TIME_STYLE behavior to align with GNU coreutils:
- test_ls_time_style_env_full_iso: TIME_STYLE environment variable with full-iso format
- test_ls_time_style_iso_recent_and_older: --time-style=iso formatting for recent vs older files
- test_ls_time_style_posix_locale_override: Locale-based fallback with LC_ALL=POSIX
- test_ls_time_style_precedence_last_wins: Precedence between --full-time and --time-style
- test_ls_time_sort_without_long: Time-based sorting without -l flag
These tests directly address remaining gaps highlighted in #4627 for tests/ls/ls-time.sh
from the GNU test suite.
* tests(ls): use set_modified instead of touch; simplify assertions
- Replace #[cfg(feature = "touch")] with set_modified(UNIX_EPOCH) in test_ls_time_style_iso_recent_and_older
- Remove conditional blocks in test_ls_time_sort_without_long and set mtimes via set_modified
- Simplify assertion to assert_ne!(def, t) to compare full outputs
Rationale: Improves determinism, portability, and reduces branching as suggested by maintainer cakebaker in PR review comments.
Improve test_total robustness by using --output=size,used,avail to get
numeric-only columns, avoiding fragile whitespace parsing of Filesystem
and Mounted on columns which can contain spaces in mount point names.
This makes the test more reliable across different filesystem configurations
and mount point naming conventions.
Adds two fixture-based tests to verify GNU-compatible behavior:
- `test_tex_format_no_truncation_markers`: Ensures TeX format does not
display truncation markers.
- `gnu_ext_disabled_chunk_no_over_reading`: Verifies that text chunks
do not over-read at boundaries in traditional mode.
* fix(ptx): Remove extra space before truncation marker and a regression test (`test_truncation_no_extra_space_in_after`) has been added. Close#8783
* fix(ptx): Remove extra space before truncation marker and a regression test (`test_truncation_no_extra_space_in_after`) has been added. Close#8783