Skip to content

Conversation

@mattsu2020
Copy link
Contributor

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

related
#9959

Implement support for preserving byte sequences in date command output when dealing with invalid UTF-8 in format arguments or formatted strings. This prevents failures on non-UTF-8 data, especially on Unix systems, by introducing OutputEncoding enum (Utf8/BytePreserving), updating format parsing to use OsString, and adding write_formatted_output function. Addresses issues with binary-safe output in custom date formats.
Moved the ShortcutValueParser import after the unix-specific import to better organize platform-specific and general imports in date.rs.
Add #[cfg_attr(not(unix), allow(dead_code))] to OutputEncoding::BytePreserving,
CustomFormatError::InvalidUtf8, locale_output_encoding(), and decode_byte_preserving()
to allow these items to be unused on non-Unix systems without triggering warnings.
This improves code quality and reduces noise in builds on unsupported platforms.
@github-actions
Copy link

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!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant