Skip to content

date:UTF-8 checks exist to keep custom date formats binary-safe#9972

Open
mattsu2020 wants to merge 2 commits intouutils:mainfrom
mattsu2020:date_9959
Open

date:UTF-8 checks exist to keep custom date formats binary-safe#9972
mattsu2020 wants to merge 2 commits intouutils:mainfrom
mattsu2020:date_9959

Conversation

@mattsu2020
Copy link
Copy Markdown
Contributor

new OutputEncoding enum, byte-preserving helpers, and UTF-8 checks exist to keep custom date formats binary-safe.

related
#9959

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jan 1, 2026

GNU testsuite comparison:

Congrats! The gnu test tests/shuf/shuf-reservoir is no longer failing!
Congrats! The gnu test tests/sort/sort-stale-thread-mem is no longer failing!

@sylvestre
Copy link
Copy Markdown
Contributor

i think something went wrong with the stack of commits

@github-actions
Copy link
Copy Markdown

GNU testsuite comparison:

Skipping an intermittent issue tests/shuf/shuf-reservoir (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/sort/sort-stale-thread-mem (passes in this run but fails in the 'main' branch)

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Jan 14, 2026

Merging this PR will not alter performance

✅ 287 untouched benchmarks
⏩ 38 skipped benchmarks1


Comparing mattsu2020:date_9959 (7e7edb1) with main (289d701)

Open in CodSpeed

Footnotes

  1. 38 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.

@github-actions
Copy link
Copy Markdown

GNU testsuite comparison:

Congrats! The gnu test tests/sort/sort-float is no longer failing!

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
Comment thread src/uu/date/src/date.rs Outdated
Comment thread src/uu/date/src/date.rs
Some(out)
}

fn write_formatted_output(
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 is it used ?

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.

@github-actions
Copy link
Copy Markdown

GNU testsuite comparison:

GNU test failed: tests/tail/follow-name. tests/tail/follow-name is passing on 'main'. Maybe you have to rebase?

1 similar comment
@github-actions
Copy link
Copy Markdown

GNU testsuite comparison:

GNU test failed: tests/tail/follow-name. tests/tail/follow-name is passing on 'main'. Maybe you have to rebase?

@github-actions
Copy link
Copy Markdown

GNU testsuite comparison:

GNU test failed: tests/misc/io-errors. tests/misc/io-errors is passing on 'main'. Maybe you have to rebase?
Skipping an intermittent issue tests/tty/tty-eof (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/cut/bounded-memory is no longer failing!

This commit removes the strict UTF-8 validation that was previously enforced on Unix systems when using custom format strings with the date command. Previously, if a format string contained invalid UTF-8 bytes and the locale was set to UTF-8, the command would fail with an error. Now, the command will always attempt to decode format strings in a byte-preserving manner, allowing non-UTF-8 format strings to work regardless of the locale setting.

The change simplifies the behavior by removing the conditional UTF-8 validation logic and associated error handling, making the date command more permissive with format strings containing invalid UTF-8 sequences.
@github-actions
Copy link
Copy Markdown

GNU testsuite comparison:

GNU test failed: tests/head/head-write-error. tests/head/head-write-error is passing on 'main'. Maybe you have to rebase?
Skipping an intermittent issue tests/tail/follow-name (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/tty/tty-eof (passes in this run but fails in the 'main' branch)
Note: The gnu test tests/tail/tail-n0f is now being skipped but was previously passing.

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.

2 participants