| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Merging this PR will degrade performance by 6.25%⚠️ Different runtime environments detected
❌ 3 regressed benchmarks Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent. Comparing 0xSoftBoi:fix/ignore-trailing-noise-tokens (7d069b4) with main (4b412e0) |
Sorry, something went wrong.
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #286 +/- ##
=======================================
Coverage 99.30% 99.31%
=======================================
Files 20 21 +1
Lines 3894 3942 +48
Branches 122 123 +1
=======================================
+ Hits 3867 3915 +48
Misses 26 26
Partials 1 1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness.
|
Sorry, something went wrong.
|
please run cargo fmt |
Sorry, something went wrong.
|
Review bump on this PR. I see the current blockers are the formatting failure and the CodSpeed regression flag; I can follow up on the formatting immediately, but I’d still appreciate a maintainer read on whether the GNU-compat behavior for trailing noise-after-pure-number is acceptable before this drifts. |
Sorry, something went wrong.
|
Pushed 06267b3 to address the CodSpeed regression. Instead of making Item::Noise a global alt branch, noise consumption is now folded into parse_item and only fires after a Pure item, gated on a cheap peek that confirms the next token is not a real item (timezone/offset/etc., e.g. BRT in 8 BRT). That keeps the hot invalid-input and weekday paths byte-identical to main (no extra alt branch), so the previous -13.27% flag on parse_invalid_input should clear. All 377 tests still pass and the original noise_after_pure_number cases (8j, 8 j, 1230foo, plus the negative cases) are unchanged. cc @sylvestre |
Sorry, something went wrong.
GNU date accepts bare "UT" and "ut" as a synonym for UTC (+0).
parse_datetime rejected them because the abbreviation was absent from
the named-timezone lookup table in timezone_name_to_offset().
Add "ut" => Ok("+0") immediately after the existing "utc" entry and
add a regression test that verifies all four case variants are
accepted and resolve to a UTC-offset-0 instant.
Fixes uutils#280
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…re numbers GNU date accepts inputs like '8j' and '8 j', treating the number as an hour and silently discarding the unrecognized trailing word-token. This commit matches that behaviour. Implementation: - Add Item::Noise variant for unrecognized alphabetic tokens - Add noise_token() as the last alternative in parse_item(), so it only fires after every other parser has failed - In DateTimeBuilder::try_from, accept Noise only when it directly follows a Pure number item (prev_was_pure guard); reject it anywhere else so that leading garbage (e.g. 'bogus +1 day') and post-date garbage (e.g. '2025-01-01 abcdef') still produce errors - Add noise_after_pure_number regression test covering both '8j' and '8 j' Fixes uutils#279
The original noise-token alt-branch made every invalid alphabetic input take an extra parse-item iteration plus a builder-level rejection, which showed up as a -13.27% regression on the parse_invalid_input bench. Restructure: drop the global Item::Noise variant and instead absorb trailing GNU-compat noise inside parse_item only after a Pure item was matched, gated on a cheap peek that confirms the next token is not a real item (datetime/date/time/relative/weekday/offset/pure). This keeps the hot invalid-input and weekday paths identical to main (no extra alt branch), while still passing all noise_after_pure_number cases: - 8j -> 08:00:00 - 8 j -> 08:00:00 - 1230foo -> 12:30 - bogus +1 day -> error (leading garbage) - 2025-01-01 abcdef -> error (noise after non-pure) - notadate -> error (standalone unrecognized) All 377 tests pass; cargo fmt and clippy clean.
|
I don't think this is the right fix — GNU accepts 8j because j is a military timezone letter (local time), not because it discards unrecognized tokens. You can see this because GNU also accepts 8 z→08:00, 8 k→22:00, 8 brt→11:00 (all timezones), but rejects 8foo, 1230foo, 8 pizza, 8xyz. The generic noise-swallowing here makes all of those invalid inputs parse successfully, diverging from GNU and (when wired into coreutils) breaking its existing --set 123abcd invalid-date test. The correct scope for #279 is much narrower: add j to the named-timezone table (it already resolves z/k/brt), rather than consuming arbitrary trailing alpha after a pure number. |
Sorry, something went wrong.
|
Closing this in favour of #320, which does the same job on a correct premise. @sylvestre — your review was right, and it is worth recording exactly how. This PR assumed GNU silently ignores unrecognized trailing alphabetic tokens after a pure number. It does not: $ date -d '8foo' date: invalid date ‘8foo’ So the "ignore the noise" model was wrong. I checked the whole alphabet against GNU coreutils 9.4, and the real rule is narrower: every letter a–y is a military time zone, and all of them were already in our table except j. That one letter was the entire gap. j was missing because it is the only letter that is not a fixed offset — it means local time: $ TZ=America/New_York date -d '8j' # 08:00 -0400 (same as bare '8') $ TZ=America/New_York date -d '2026-01-01 j' # 00:00 -0500 (DST-aware) $ TZ=America/New_York date -d '8z' # 04:00 -0400 (z is UTC) So it cannot be represented as an Offset at all, which is presumably why it was skipped originally. #320 adds it as a proper time zone item — so 8j utc and 8 j j are still rejected as a repeated zone, and 8foo still errors. All 26 letters now match GNU exactly. This branch is also five months behind main and its diff would revert several later fixes, including my own am/pm change, so #320 is a fresh branch from current main rather than an update here. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Summary
Implementation
Test Plan
Fixes #279