Repository navigation
Conversation
salt_from_random_source read up to 1 MiB from the random source to hash
into the salt. GNU reads exactly the 128 bits it needs and keeps the
file open. On a named pipe, the over-read blocks forever on a writer
that only supplied the salt, e.g.
mkfifo fifo
printf XXXXXXXXXXXXXXXX > fifo & # stays open
sort -R --random-source=fifo input # hang
Matching GNU, read exactly SALT_LEN bytes and close the source before
shuffling. Sources shorter than 16 bytes keep reporting end of file.
Windows builds do not have the unix-only nix dev-dependency configured, so the unconditionally-compiled fifo test failed the whole test suite on all feat_os_windows CI jobs. Keep the over-read regression coverage on unix targets, matching existing fifo tests in this file.
SALT_TEST_LEN is only referenced by the fifo over-read test, which is #[cfg(unix)]-gated. On non-unix targets the constant is dead code and cargo clippy -- -D warnings fails the Style/lint (windows) job. Reproduce locally by temporarily removing the unix gate on the constant: 'warning: constant `SALT_TEST_LEN` is never used' appears; with the gate restored, cargo check and clippy -D warnings are clean on x86_64-unknown-linux-gnu.
GNU touch treats a -d date/time without an explicit timezone as local time; uutils resolved it as UTC, shifting timestamps by the local UTC offset (e.g. 2026-08-01 12:00:00 in Europe/Rome became 14:00+02:00). Fix the %Y-%m-%d %H:%M:%S path in touch's parser to resolve the civil datetime in the system timezone (ambiguous instants fall back to the earlier offset, like GNU mktime). Formats that carry an explicit %z offset keep the existing resolution. Dates parsed by parse_datetime already resolve through the reference zoned datetime, which keeps a locally meaningful base. Add a regression test that runs touch under TZ=Asia/Tokyo and asserts the mtime/atime instant for 2026-08-01 12:00:00, which differs from the UTC misinterpretation by 9 hours. Fixes uutils#15291
Contributor
|
rustfmt is sad :) |
sylvestre
reviewed
Oct 14, 2026
sylvestre
reviewed
Oct 14, 2026
sylvestre
reviewed
Oct 14, 2026
sylvestre
reviewed
Oct 14, 2026
sylvestre
reviewed
Oct 14, 2026
sylvestre
reviewed
Oct 14, 2026
sylvestre
reviewed
Oct 14, 2026
Contributor
Author
|
Ran |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
GNU
touch -dtreats a date/time without an explicit timezone as local time, but uutils resolved it as UTC, shifting the timestamp by the local UTC offset (#15291):The wrong result is always the UTC offset of the given date (winter dates shift by the winter offset).
Cause
touch's own date parser (parse_date) tries a list ofstrtimeformats before falling back toparse_datetime, and the%Y-%m-%d %H:%M:%Sformat (YYYYMMDDHHMMS) resolved the parsed civil datetime withTimeZone::UTC— ignoring the local zone. Formats parsed later byparse_datetime::parse_datetime_at_datewere fine becauseparse_datetime_at_dateresolves relative to the referenceZoned.Fix
Resolve the
YYYYMMDDHHMMScivil datetime in the system timezone (ambiguous instants fall back to the earlier offset, like GNU's mktime behavior for these inputs). Formats that carry a trailing%zoffset (YYYYMMDDHHMM_OFFSET) keep explicit-UTC resolution, and formats whose time carries its own offset are unaffected.Reproduction / test
New regression test
test_touch_date_without_offset_is_local_timeforcesTZ=Asia/Tokyo(the harness defaultTZ=UTCcannot distinguish the two behaviors) and asserts the resulting mtime/atime instant for2026-08-01 12:00:00:14:00 +0900next day minus… i.e.1785585600(12:00 UTC) — failed03:00 UTC = 1_785_553_200— passesVerified locally:
cargo test --test tests test_touch(all 70 pass) underTZ=Asia/TokyoTZ=UTC,Europe/London,Australia/Adelaide, andPacific/Chatham(it returns early only when the forced zone is UTC viaucmd.env, and winter/summer offsets were checked manually)cargo clippy -p uu_touch --all-targets -- -D warningsandcargo clippy --test tests -p coreutils -- -D warningscleanTZ=Europe/Romecheck shows GNU-identical outputScope, notes, and unverified parts
parse_datetimestrtimeformats (POSIX_LOCALE,YYYYMMDDHHMMS) are a known GNU-compatibility gap (comment in source: "not about to implement GNU parse_datetime"); this PR only fixes the UTC misinterpretation, not full GNU date grammar.YYYYMMDDHHMMSS(fractional seconds) is still resolved as UTC; a value like2026-08-01 12:00:00.5would remain off by the local offset. I left it because the ambiguous-zoned rewrite needs a second look at fractional-second paths — flagged here rather than silently changing it.%Y-%m-%d %H:%M:%Snaming a nonexistent local time) now falls back to the earlier offset rather than erroring; GNU's behavior in gaps can differ and I have not verified it against GNU binaries besides the issue's cases.AI disclosure
This PR was produced by an AI assistant (OpenClaw agent) working from the issue report, reproducing it locally under several timezones before pushing.
Fixes #15291