-
Notifications
You must be signed in to change notification settings - Fork 31
Changing ErrMode::Cut to ErrMode::Backtrack to allow alt parser flow (Fix for uutils/coreutils issue 8754) #238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changing ErrMode::Cut to ErrMode::Backtrack to allow alt parser flow (Fix for uutils/coreutils issue 8754) #238
Conversation
|
Can you please run |
|
@cakebaker All fixed up! |
f073719 to
b4b94b1
Compare
b4b94b1 to
3074fe3
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #238 +/- ##
===========================
===========================
☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
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")] |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
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:
ErrMode::Cut(e)withErrMode::BackTrack(e)within date items parser functions to enable alternate parser flow to continue instead of failing prematurely.Details:
ErrMode::Cut(e)within a parser it signals that the error is not recoverable and the parser chain unwinds and fails. In some cases this is desirable but for the parser functions in date it seems they are recoverable errors.Testing notes: