Skip to content
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

Improve xchar support for std::bitset formatter and fix fill copying bug #4286

Merged
merged 2 commits into from
Jan 3, 2025

Conversation

phprus
Copy link
Contributor

@phprus phprus commented Jan 2, 2025

Fixes #4285

Improve xchar support for std::bitset formatter and fix a bug when copying the fill from basic_specs.

@vitaut vitaut merged commit dad3237 into fmtlib:master Jan 3, 2025
45 checks passed
@vitaut
Copy link
Contributor

vitaut commented Jan 3, 2025

Merged, thanks!

@ja11sop
Copy link

ja11sop commented Jan 3, 2025

It looks like this commit has broken other behaviour - the following code now segfaults:

Stream << fmt::format( "{}", fmt::styled( Line, Style ) ) << "\n";

will try and get more details and add an issue - I suggest reverting this for now as it breaks consistently across our entire codebase in code used in our test reporting.

@ja11sop
Copy link

ja11sop commented Jan 3, 2025

to be more precise here:

#0  0x000055555568bbf3 in fmt::v11::detail::buffer<char>::append<char> (this=0x0, begin=begin@entry=0x7fffffffb400 "\033[34m", end=end@entry=0x7fffffffb405 "")
    at /home/user/_download/git_https_github.com__fmtlib_fmt.git/include/fmt/base.h:1797

@phprus
Copy link
Contributor Author

phprus commented Jan 3, 2025

@ja11sop
Thanks for the report!
I'll have a look tomorrow.

@phprus
Copy link
Contributor Author

phprus commented Jan 3, 2025

@ja11sop
Tests for fmt::styled pass without errors:

fmt/test/color-test.cc

Lines 53 to 58 in dad3237

EXPECT_EQ(fmt::format("{}{}", fmt::styled("red", fg(fmt::color::red)),
fmt::styled("bold", fmt::emphasis::bold)),
"\x1b[38;2;255;000;000mred\x1b[0m\x1b[1mbold\x1b[0m");
EXPECT_EQ(fmt::format("{}", fmt::styled("bar", fg(fmt::color::blue) |
fmt::emphasis::underline)),
"\x1b[4m\x1b[38;2;000;000;255mbar\x1b[0m");

Please provide the value ​​of the `Style`` variable that cause the crash.
Or provide minimum code sample, please.

@ja11sop
Copy link

ja11sop commented Jan 4, 2025

Please see #4289 - yes I can see those tests must have passed since the PR was merged but I am not sure they quite match the simple case shown in the linked issue.

I admit that it seems odd this PR affected things but reviewing the stack trace and looking at the code tells me the backend for fmt is not trivial, plus without this PR we have no issue, with the PR we do.

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.

std::bitset formatting (nested_formatter) does not work with wchar_t
3 participants