Skip to content

date: expand GNU-compatible parsing and formatting - #15111

Open
anastygnome wants to merge 1 commit into
uutils:mainfrom
anastygnome:test-util
Open

anastygnome wants to merge 1 commit into
uutils:mainfrom
anastygnome:test-util

Conversation

@anastygnome

@anastygnome anastygnome commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Handle extended years, GNU debug diagnostics, epoch seconds, normalization, DST gaps, and strftime modifier precedence

refs #14705

@anastygnome
anastygnome marked this pull request as ready for review October 6, 2026 05:02
@codspeed

codspeed Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Merging this PR will degrade performance by 12.58%

⚠️ 1 benchmark spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

❌ 5 regressed benchmarks
✅ 7 untouched benchmarks
⏩ 444 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ Simulation file_custom_format 30 ms 36.5 ms -17.9%
❌ Simulation file_iso_dates 31.5 ms 38.2 ms -17.52%
❌ Simulation file_localized_names 41.9 ms 48.6 ms -13.73%
❌ Simulation file_tz_abbreviations 35.4 ms 38.1 ms -7.07%
❌ Simulation complex_relative_date 292.8 µs 311.4 µs -5.97%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing anastygnome:test-util (2b5fe3a) with main (38336e9)

Open in CodSpeed

Footnotes

  1. 444 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@anastygnome
anastygnome force-pushed the test-util branch 2 times, most recently from ce6b516 to 2e6eecf Compare October 6, 2026 05:15
@anastygnome

Copy link
Copy Markdown
Contributor Author

extra work => additional cost.

@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

GNU testsuite comparison:

Congrats! The gnu test tests/date/date is no longer failing!
Congrats! The gnu test tests/date/date-tz is no longer failing!

@anastygnome

Copy link
Copy Markdown
Contributor Author

CICD and Android are related to tail/cp, nothing related to this PR

@sylvestre

Copy link
Copy Markdown
Contributor

sorry, but we can't take this: emit_gnu_debug hardcodes the expected output for specific GNU test inputs, which doesn't fix anything and looks taken from the GNU tests. If you want to keep going, please split it into small PRs that fix real behavior, one at a time.

@anastygnome

Copy link
Copy Markdown
Contributor Author

@sylvestre would making the non debug tests into one PR be ok?

@sylvestre

Copy link
Copy Markdown
Contributor

just the tests or tests+fixes?

@anastygnome

Copy link
Copy Markdown
Contributor Author

I mean the code & test that fix tests/date/date & date/date-tz are very similar (I blieve matching debug output isn"t really wise but I had matched it to see if we could and discuss it here

@sylvestre

Copy link
Copy Markdown
Contributor

Sure but this pr is huge. I would prefer smaller changes

@anastygnome
anastygnome force-pushed the test-util branch 4 times, most recently from ef60759 to d6ed595 Compare October 6, 2026 07:57
@anastygnome

anastygnome commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor Author

I reduced the scope @sylvestre

@anastygnome

Copy link
Copy Markdown
Contributor Author

@cakebaker @xtqqczze if one od you may review this it'd be appreciated

Comment thread src/uu/date/src/format_modifiers.rs Outdated
Comment thread src/uu/date/src/format_modifiers.rs
Comment thread src/uu/date/src/format_modifiers.rs Outdated

@cakebaker cakebaker left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'll likely wrap up the review tomorrow. The tests look fine.

@anastygnome

anastygnome commented Oct 7, 2026 via email •

Copy link
Copy Markdown
Contributor Author

Comment thread src/uu/date/src/format_modifiers.rs Outdated
Comment thread src/uu/date/src/format_modifiers.rs Outdated
Comment thread src/uu/date/src/format_modifiers.rs Outdated
Comment thread src/uu/date/src/format_modifiers.rs Outdated
Comment thread src/uu/date/src/format_modifiers.rs Outdated
Comment thread src/uu/date/src/date.rs Outdated
@anastygnome

Copy link
Copy Markdown
Contributor Author

@cakebaker thanks, I believe your suggestions make sense. Will implement them shortly.

Comment thread src/uu/date/src/date.rs
Comment thread src/uu/date/src/date.rs Outdated
Comment thread src/uu/date/src/date.rs Outdated
Comment thread src/uu/date/src/date.rs Outdated
Comment thread src/uu/date/src/date.rs Outdated
Comment thread src/uu/date/src/date.rs
Comment thread src/uu/date/src/date.rs
Comment thread src/uu/date/src/date.rs
if bytes.get(index) == Some(&b'%') {
output.push_str("%%");
index += 1;
continue;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

same flag/width parsing as in substitute_epoch_seconds_value, could be dedup, no?

Comment thread src/uu/date/src/date.rs
| "wednes"
| "thursday"
| "thu"
| "thu."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

where does this list (wednes, tues, thurs...) come from?

@anastygnome anastygnome Oct 10, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

GNU documents these forms in its "Day of week items" section.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

didn't see the last line there, so I corrected it as well.

@sylvestre

Copy link
Copy Markdown
Contributor

the patch is still too big

Comment thread src/uu/date/src/date.rs Outdated
Comment thread src/uu/date/src/date.rs Outdated
Comment thread src/uu/date/src/date.rs Outdated

@cakebaker cakebaker left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Done

Comment thread src/uu/date/src/format_modifiers.rs Outdated
Comment thread src/uu/date/src/format_modifiers.rs Outdated
@anastygnome
anastygnome force-pushed the test-util branch 2 times, most recently from ef85943 to c233d2b Compare October 10, 2026 09:09

This branch has not been deployed

No deployments
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.

4 participants