Skip to content

printf: improve support of printing multi-byte values of characters #7208

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

Merged
merged 5 commits into from
Apr 24, 2025

Conversation

jtracey
Copy link
Contributor

@jtracey jtracey commented Jan 24, 2025

Based on #7048.

Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/misc/usage_vs_getopt (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/timeout/timeout (passes in this run but fails in the 'main' branch)

@jtracey jtracey marked this pull request as draft January 25, 2025 00:37
@jtracey jtracey marked this pull request as ready for review January 25, 2025 03:38
@jtracey
Copy link
Contributor Author

jtracey commented Jan 25, 2025

I was worried because, unlike #7048, this doesn't get the printf-mb GNU test to pass, but on closer investigation, the test was only passing due to a coincidental bug that made it pass, despite failing in the general case.

The problem is the same described here: #7048 (comment)
To see it in practice, run printf '%s' $(printf '\x61\xC3\xA1\xC0') and cargo run printf '%s' $(printf '\x61\xC3\xA1\xC0'), where non-cargo printf is GNU's, and the repo is checked out at 8f4c286. You'll get aá� and aáÀ, respectively. Proper multibyte support won't work until #6812 (or a successor) gets merged.

@jtracey
Copy link
Contributor Author

jtracey commented Jan 25, 2025

To be clear for posterity, the version in this PR will look correct and show aá�, but GNU's is actually passing the 0xC0 byte to the terminal, which is in turn rendering it with �. It's easier to see the remaining problem, the one we need #6812 to solve, if you redirect the output to a hex editor or the like.

@jtracey
Copy link
Contributor Author

jtracey commented Feb 21, 2025

Force push is a rebase on main.

@jtracey jtracey force-pushed the printf-go branch 2 times, most recently from aacad95 to 1a16a34 Compare March 11, 2025 20:31
Copy link

GNU testsuite comparison:

Congrats! The gnu test tests/misc/tee is no longer failing!

@jtracey
Copy link
Contributor Author

jtracey commented Mar 11, 2025

@sylvestre: Do you expect this to merge soon? If not, I can just pause the rebases until you ping me.

@sylvestre
Copy link
Contributor

@jtracey sorry, i missed your message :(

@sylvestre
Copy link
Contributor

yeah, it looks good!

Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/misc/stdbuf (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/tail/inotify-dir-recreate (passes in this run but fails in the 'main' branch)

@jtracey
Copy link
Contributor Author

jtracey commented Apr 18, 2025

@sylvestre No worries. :)

Should be good to merge now.

@jtracey
Copy link
Contributor Author

jtracey commented Apr 22, 2025

@sylvestre ping

@sylvestre sylvestre merged commit 18db15e into uutils:main Apr 24, 2025
70 checks passed
@sylvestre
Copy link
Contributor

thanks for the ping

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