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_ALL to control the locale #27

Merged
merged 1 commit into from
Feb 10, 2022
Merged

Set LC_ALL to control the locale #27

merged 1 commit into from
Feb 10, 2022

Conversation

skitt
Copy link
Contributor

@skitt skitt commented Feb 10, 2022

LANG specifies the default locale, LC_NUMERIC specifies the locale for
that particular category, but LC_ALL overrides all the locale
settings. Thus any user with LC_ALL set can still run into
locale-related problems.

Setting LC_ALL to C avoids any such issue.

See locale(7) for details.

Signed-off-by: Stephen Kitt steve@sk2.org

LANG specifies the default locale, LC_NUMERIC specifies the locale for
that particular category, but LC_ALL overrides all the locale
settings. Thus any user with LC_ALL set can still run into
locale-related problems.

Setting LC_ALL to C avoids any such issue.

See locale(7) for details.

Signed-off-by: Stephen Kitt <steve@sk2.org>
@ashaduri
Copy link
Owner

Hello,

Thanks a lot for the patch.

Indeed, Linux locale(7) states this behavior. I dug a bit deeper and it seems to come from POSIX, with FreeBSD, Darwin, and Solaris having the same behavior.

I have not found a way to force LC_NUMERIC on Windows yet, but a future JSON output parser will solve this anyway, at least when invoking smartctl.

Thanks!

@ashaduri ashaduri merged commit 594f177 into ashaduri:main Feb 10, 2022
@skitt
Copy link
Contributor Author

skitt commented Feb 10, 2022

Ah yes, I should have provided the POSIX reference — https://pubs.opengroup.org/onlinepubs/9699919799/utilities/locale.html

@skitt skitt deleted the lcall branch February 10, 2022 08:24
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.

2 participants