Skip to content

Conversation

@stillbeingnick
Copy link
Contributor

@stillbeingnick stillbeingnick commented Oct 2, 2025

This PR purposes changes that fix uutils/coreutils#8754 after a chore in coreutils to move from parse_datetime v0.11.0 to the latest including this fix.

Summary:

  • Replaced ErrMode::Cut(e) with ErrMode::BackTrack(e) within date items parser functions to enable alternate parser flow to continue instead of failing prematurely.

Details:

Testing notes:

  • New tests have been added to confirm parsing of relative time up to 12 whole decimal places and inverse test cases testing for failure of 13 -> 15 whole decimal places.
  • All previous test cases remain unchanged.

@cakebaker
Copy link
Collaborator

Can you please run cargo fmt and cargo clippy? Thanks.

@stillbeingnick
Copy link
Contributor Author

@cakebaker All fixed up!

@cakebaker cakebaker force-pushed the bugfix/issue/coreutils-date-invalid branch from f073719 to b4b94b1 Compare October 4, 2025 14:52
@cakebaker cakebaker force-pushed the bugfix/issue/coreutils-date-invalid branch from b4b94b1 to 3074fe3 Compare October 4, 2025 14:55
@cakebaker cakebaker merged commit c239ed0 into uutils:main Oct 4, 2025
17 checks passed
@codecov
Copy link

codecov bot commented Oct 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.00%. Comparing base (29e3686) to head (3074fe3).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@     Coverage Diff     @@
##   main   #238   +/-   ##
===========================
===========================

☔ View full report in Codecov by Sentry.
📢 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.

@cakebaker
Copy link
Collaborator

Thanks for your PR!

#[rstest]
#[case::decimal_13_whole("1234567891234.123456789 seconds ago")]
#[case::decimal_14_whole("12345678912345.123456789 seconds ago")]
#[case::decimal_15_whole("123456789123456.123456789 seconds ago")]
Copy link

@jepler jepler Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gnudate is happy with timestamps this far in the future or past

$ docker run -it --rm ubuntu:25.10  date --date="123456789123456 seconds"
date: invalid date '123456789123456 seconds'
$ docker run -it --rm ubuntu:25.10  gnudate --date="123456789123456 seconds"
Sun Sep 24 07:14:00 UTC 3914215
$ docker run -it --rm ubuntu:25.10  gnudate --date="123456789123456 seconds ago"
Mon Nov 30 18:39:36 UTC -3910165

am I misinterpreting or is this test making sure parse_datetime (and thus uutils date) will reject such a large value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the tests were written to ensure errors were produced at the boundary line of 13 whole digits. Which is a limitation somewhere during parsing or conversion, I honestly haven't tracked it down yet. The hope is that these tests provide a little future proofing. The failure of the tests during subsequent releases would signal a change in known current behavior.

As for what parse_datetime should do, the direction seems to be to align with current implementations of date. So, my vote would be to support that and align as closely as possible to current implementations.

I do think this warrants an issue to close the gap and figure out what is causing this to not handle the same size relative time values as gnudate.

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.

Invalid date of date -d "12345.123456789 seconds ago" +"%s.%N"

3 participants