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

Set LC_NUMERIC=C to avoid issues reading files #120

Closed
wants to merge 2 commits into from

Conversation

ahcorde
Copy link
Contributor

@ahcorde ahcorde commented Nov 4, 2020

Related with this issue gazebosim/gz-rendering#101

Signed-off-by: ahcorde [email protected]

@ahcorde ahcorde added the bug Something isn't working label Nov 4, 2020
@ahcorde ahcorde requested a review from mjcarroll as a code owner November 4, 2020 13:07
@ahcorde ahcorde self-assigned this Nov 4, 2020
@github-actions github-actions bot added 🏢 edifice Ignition Edifice 🏰 citadel Ignition Citadel 📜 blueprint Ignition Blueprint 🔮 dome Ignition Dome labels Nov 4, 2020
@ahcorde ahcorde force-pushed the ahcorde/set_locale branch from 418096a to 93309f3 Compare November 4, 2020 13:15
@codecov
Copy link

codecov bot commented Nov 4, 2020

Codecov Report

Merging #120 (1dc83b0) into ign-common3 (8eb57de) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##           ign-common3     #120   +/-   ##
============================================
  Coverage        73.99%   74.00%           
============================================
  Files               69       69           
  Lines             9433     9435    +2     
============================================
+ Hits              6980     6982    +2     
  Misses            2453     2453           
Impacted Files Coverage Δ
graphics/include/ignition/common/MeshLoader.hh 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8eb57de...1dc83b0. Read the comment docs.

Copy link
Contributor

@chapulina chapulina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you write a test to make sure we don't break it and that it works with all platforms? There are some examples here:

@@ -32,7 +33,9 @@ namespace ignition
class IGNITION_COMMON_GRAPHICS_VISIBLE MeshLoader
{
/// \brief Constructor
public: MeshLoader() = default;
public: MeshLoader() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public: MeshLoader() {
public: MeshLoader()
{

@chapulina chapulina requested a review from j-rivero November 9, 2020 19:48
@mjcarroll
Copy link
Contributor

@j-rivero to add tests.

@j-rivero j-rivero self-assigned this Nov 16, 2020
@@ -32,7 +33,9 @@ namespace ignition
class IGNITION_COMMON_GRAPHICS_VISIBLE MeshLoader
{
/// \brief Constructor
public: MeshLoader() = default;
public: MeshLoader() {
std::setlocale(LC_NUMERIC, "C");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is influencing the global state of the process in a way that is not documented and may not be ideal for a library. Furthermore, other part of the process can then set again the LC_NUMERIC to other values, breaking the functionality of the class after it has been created.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this is relevant to what you explained here gazebosim/gz-rendering#136, right? So instead of this PR we should try to identify which part of the code is using locale dependent commands and apply changes there.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly. To be perfectly clear, it is not tragic if this is merged, but I still wanted to raise the point that is not ideal to perturb the global state from a library.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, this is kind of a concerning workaround. It may not break anything as-is, but it's sort of a bad "code smell" that this is necessary.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed in one of the meetings, let's decline this PR and try to address the underlying issue instead.

@chapulina
Copy link
Contributor

We should address the underlying issue instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📜 blueprint Ignition Blueprint bug Something isn't working 🏰 citadel Ignition Citadel 🔮 dome Ignition Dome 🏢 edifice Ignition Edifice
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants