Skip to content

date: fix the strftime O and E modifier leaks #11656 (new)#11834

Open
tobyw21 wants to merge 3 commits intouutils:mainfrom
tobyw21:tobyw21-date-patch
Open

date: fix the strftime O and E modifier leaks #11656 (new)#11834
tobyw21 wants to merge 3 commits intouutils:mainfrom
tobyw21:tobyw21-date-patch

Conversation

@tobyw21
Copy link
Copy Markdown

@tobyw21 tobyw21 commented Apr 15, 2026

This is a new PR to a broken old PR #11714 and trying to address issue #11656.
This PR fixes date: strftime with O and E modifiers. Fixes #11656

Changes

  • coreutils/src/uu/date/src/format_modifiers.rs:105, in bytes matching, added O and E bytes match.
  • add tests for O and E modifiers with valid specifier and invalid specifiers according gnu date behaviours in the documentation

Limitations

Currently block the BrokenDownTime calling to_string_with_config if modifier E or O combines with invalid specifiers. It pre-checks if modifier is O or E, then skip formatting if modifier is E and specifier is not in '%c', '%C', '%x', '%X', '%y' and '%Y', or if modifier is O and specifier is in '%a', '%A', '%c', '%D', '%F', '%x' and '%X'. While Jiff does not support modifier E and O, this check is to be done outside of Jiff.

Build requirements

Rust stable

Testing

Tested with make test

@github-actions
Copy link
Copy Markdown

GNU testsuite comparison:

Skipping an intermittent issue tests/pr/bounded-memory (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/tail/retry is no longer failing!
Congrats! The gnu test tests/expand/bounded-memory is now passing!

@Alonely0
Copy link
Copy Markdown
Contributor

As I have previously discussed privately with the author about this issue, I'll be reviewing it. Pretty sure most of my initial comments have been addressed in the new PR, so I might not need to be super thorough.

Copy link
Copy Markdown
Contributor

@Alonely0 Alonely0 left a comment

Choose a reason for hiding this comment

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

nitpick: for git etiquette reasons, I'd really appreciate it if you could move the comments added in the last commit to the implementation one, and squash the two commits adding tests into a single one. A clever interactive rebase should be enough, but don't hesitate to lmk if you'd like some guidance :)

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.

date: strftime O modifier leaks as literal in C locale

2 participants