Skip to content

find: report an unparsable -newerXt year instead of panicking - #762

Merged
cakebaker merged 1 commit into
uutils:mainfrom
leeewee:find-newerxt-year-parse-panic
Jul 16, 2026
Merged

cakebaker merged 1 commit into
uutils:mainfrom
leeewee:find-newerxt-year-parse-panic

Conversation

@leeewee

@leeewee leeewee commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Fixes #759.

-newerXt (-newermt/-newerat/-newerct/-newerBt) parsed the year field with .parse().unwrap(). The capturing regex's \d{4} matches Unicode decimal digits (the regex crate defaults to Unicode mode), but str::parse accepts only ASCII, so a year of four non-ASCII digits (e.g. find . -newermt 'jan 01, ٠٠٠٠') passed the regex and then panicked, aborting with exit 101.

This folds a failed year parse into the function's existing None path, so the argument is reported as find: I cannot figure out how to interpret ‘…’ as a date or time (exit 1) — matching GNU findutils and what uutils already does for other malformed dates. Added a regression assertion to parse_date_str_to_timestamps_test.

The -newerXt options parsed the year with `.parse().unwrap()`, but the
capturing regex's `\d{4}` matches Unicode decimal digits while
`str::parse` accepts only ASCII. A year of four non-ASCII digits
(e.g. `jan 01, ٠٠٠٠`) passed the regex and then panicked, aborting with
exit 101. Fold the failed parse into the existing None path so it
reports the GNU-style "I cannot figure out how to interpret ..." error
with exit 1, as uutils already does for other malformed dates.
@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.88%. Comparing base (6ceb2a7) to head (97d8100).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #762   +/-   ##
=======================================
  Coverage   91.88%   91.88%           
=======================================
  Files          35       35           
  Lines        7159     7160    +1     
  Branches      377      377           
=======================================
+ Hits         6578     6579    +1     
  Misses        437      437           
  Partials      144      144           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions

Copy link
Copy Markdown

Commit 97d8100 has test result changes:

bfs testsuite:

Test results comparison:
  Current:   TOTAL: 316 / PASSED: 267 / FAILED: 43 / SKIPPED: 6
  Reference: TOTAL: 313 / PASSED: 267 / FAILED: 40 / SKIPPED: 6

Changes from main branch:
  TOTAL: +3
  PASSED: +0
  FAILED: +3

New test failures (3):
  - gnu/files0_from_ok
  - gnu/okdir_path_empty
  - gnu/okdir_path_relative

@codspeed

codspeed Bot commented Jul 15, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 20 untouched benchmarks


Comparing leeewee:find-newerxt-year-parse-panic (97d8100) with main (6ceb2a7)

Open in CodSpeed

@cakebaker
cakebaker merged commit 03a0599 into uutils:main Jul 16, 2026
21 of 22 checks passed
@cakebaker

Copy link
Copy Markdown
Contributor

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

find: -newerXt with a non-ASCII-digit year aborts instead of erroring

2 participants