Skip to content

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

Merged
vitaut merged 2 commits intofmtlib:masterfrom
phprus:std-xchar-1
Jan 3, 2025
Merged

Improve xchar support for std::bitset formatter and fix fill copying bug#4286
vitaut merged 2 commits intofmtlib:masterfrom
phprus:std-xchar-1

Conversation

@phprus
Copy link
Copy Markdown
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.

phprus added 2 commits January 2, 2025 22:51
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
@vitaut
Copy link
Copy Markdown
Contributor

vitaut commented Jan 3, 2025

Merged, thanks!

@ja11sop
Copy link
Copy Markdown

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
Copy Markdown

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
Copy Markdown
Contributor Author

phprus commented Jan 3, 2025

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

@phprus
Copy link
Copy Markdown
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
Copy Markdown

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