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.
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.
* 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
* 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
* 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
* --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.
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.