-
Notifications
You must be signed in to change notification settings - Fork 557
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
Runtime issues caused by locale-dependent double parsing #1882
Comments
The |
This has bitten OMPL in the past, too. We worked around it like this. |
What kind of portability issues do you mean and would you have a better alternative? I'm not a big fan of using |
The fact that it's taken longer than any other C++17 feature to implement means some platforms or compilers with "complete C++17 support" sometimes come with a caveat about imperfect or incomplete I don't have any better alternatives, sorry. We just have to do our homework to figure out if all the platforms/compilers/standard libraries we support already implement this. |
We just have to do our homework to figure out if all the platforms/compilers/standard libraries we support Is it working on Ubuntu 22.04 with the default gcc and clang versions? If so, then that seems good enough. We are not offering support for Windows or backporting this. |
so this is something I would clearly consider a bug / broken functionality, and you're proposing to leave it broken for non-Humble/Rolling releases? |
I'm suggesting that we don't have to debate the solution of using |
I'm somewhat confused why nobody mentioned moveit/moveit#1099 . |
History tends to repeat itself ... is what we came up with back then. For urdfdom I came up with a locale dependent unit test which could in theory be used to test compatibility of with older compilers: |
For some reason I didn't make the connection to lexical_casts, even though I knew about it... It's concerning that this bug is still around and has even raised children. It's all over the place and I think there are even some in ROS 1 which I was planning to look at next. |
I took care of srdfdom: moveit/srdfdom#108 |
This issue is being labeled as stale because it has been open 45 days with no activity. It will be automatically closed after another 45 days without follow-ups. |
This issue was closed because it has been stalled for 45 days with no activity. |
Here is a comment pointing out runtime issues depending on locale settings: #1782 (comment)
Problem
Locale settings define the format for different things, in particular
LC_NUMERIC
defines how decimal numbers are represented. Usually, we use dot notation for all configs (say XML), but if the system or application (like Qt) uses a locale with comma-separated decimals, double parsing withstd::stod
will silently cut off the decimals causing confusing issues depending on where it occurs.Here is the same issue in urdfdom from a couple years ago: ros/urdfdom#98
Solution
I suggest switching to std::from_chars which always uses dot notation. See ros-controls/ros2_control#921 for an example PR.
Some commonly used packages affected (searching for "stod", there are also other variants like "stof"):
PRs very welcome, and please tag this issue to prevent duplicate work ;)
The text was updated successfully, but these errors were encountered: