|
Bugzilla – Full Text Bug Listing |
| Summary: | GCC 9: yast2-ruby-bindings build fails | ||
|---|---|---|---|
| Product: | [openSUSE] openSUSE Tumbleweed | Reporter: | Martin Liška <martin.liska> |
| Component: | YaST2 | Assignee: | E-mail List <yast2-maintainers> |
| Status: | RESOLVED FIXED | QA Contact: | Jiri Srain <jsrain> |
| Severity: | Normal | ||
| Priority: | P5 - None | CC: | aschnell, jreidinger |
| Version: | Current | ||
| Target Milestone: | --- | ||
| Hardware: | Other | ||
| OS: | Other | ||
| Whiteboard: | |||
| Found By: | --- | Services Priority: | |
| Business Priority: | Blocker: | --- | |
| Marketing QA Status: | --- | IT Deployment: | --- |
| Bug Depends on: | |||
| Bug Blocks: | 1120754 | ||
|
Description
Martin Liška
2019-02-20 08:50:00 UTC
Josef, any idea? affected method is https://github.com/yast/yast-ruby-bindings/blob/master/src/binary/Builtin.cc#L165 Maybe some gcc/glibc guy can check if it is reasonable what we are doing with new gcc. The goal of method is to get localized format of float. There's some strangeness with the locale. If I replace float_to_lstring with:
static VALUE
float_to_lstring(VALUE self, VALUE rfloat, VALUE rprecision)
{
std::wostringstream ss; // bnc#683881#c12: need wide chars
try
{
std::locale l ("cs_CZ.utf-8");
cout << "locale is: " << l.name() << endl;
ss.imbue (l);
}
catch (const std::runtime_error &error)
{
__builtin_abort();
}
ss.precision (1);
ss << 0.1234f;
std::wstring res = ss.str();
std::wcerr << L"res:" << res << std::endl;
__builtin_abort();
I get:
[100%] Built target py2lang_ruby
.......locale is: cs_CZ.utf-8
res:
F.
So empty string. While a standalone program does (with latest GCC):
$ cat repro.cc && g++ repro.cc -g && LANG="cs_CZ.utf-8" LANG="cs_CZ.utf-8" ./a.out
#include <sstream>
#include <iostream>
using namespace std;
int main()
{
std::wostringstream ss; // bnc#683881#c12: need wide chars
try
{
std::locale l ("cs_CZ.utf-8");
cout << "locale is: " << l.name() << endl;
ss.imbue (l);
}
catch (const std::runtime_error &error)
{
__builtin_abort();
}
ss.precision (1);
ss << 0.1234f;
std::wstring res = ss.str();
std::wcerr << L"res:" << res << std::endl;
return 0;
}
locale is: cs_CZ.utf-8
res:0,1
I would simply use: http://www.cplusplus.com/reference/string/to_wstring/ AFAIR the global C++ locale is not set in YaST so to_wstring does not return the localized string. Setting the global C++ locale is something that likely needs a lot of testing to avoid regressions. Question is why it works before and start failing now. What changed in gcc? Martin: also in your test example you have fixed locale and also fixed input. I have no idea what can affect it to write no string. I worry we need our gcc experts as for me it looks like bug in gcc that some side effect break owstringstream. Fixed as I had wrongly: Ignore: libstdc++6 in project config. |