* 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
Fix dd failures with 'IO Error: Invalid input' when using
oflag=direct with partial blocks. The issue occurs because O_DIRECT requires
proper alignment for all writes, but the final partial block may not meet
these requirements.
This fix:
- Detects EINVAL errors that might be O_DIRECT alignment issues
- Temporarily removes O_DIRECT flag using fcntl(F_SETFL)
- Retries the write operation without the direct flag
- Restores original flags (safer than GNU approach)
- Only activates on Linux/Android platforms where O_DIRECT is supported
Matches GNU dd behavior discovered through strace analysis.
* --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>
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.
- 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