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

fix: use LC_ALL=C.UTF-8 for subscription-manager #3669

Merged
merged 0 commits into from
Feb 2, 2023

Conversation

ptoscano
Copy link
Contributor

Signed-off-by: Pino Toscano [email protected]

All Pull Requests:

Check all that apply:

  • Have you followed the guidelines in our Contributing document, including the instructions about commit messages?
  • Is this PR to correct an issue?
  • Is this PR an enhancement?

Complete Description of Additions/Changes:

The default environment for simple_command includes LC_ALL=C, which means ASCII (and not unicode); in case the language of the system is set to a non-English locale that uses unicode characters (e.g. non-Latin1 languages), then subscription-manager will fail to output that with encoding issues (e.g. [1]).

As a simple solution, enforce an unicode English locale for subscription-manager, which should avoid those encoding issues.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=2074745

@subpop subpop requested a review from xiangce January 31, 2023 12:59
@ptoscano
Copy link
Contributor Author

Another possibility here could be the modify SAFE_ENV directly to be unicode, applying the same for every command run:

diff --git a/insights/core/spec_factory.py b/insights/core/spec_factory.py
index 5d433f92..03a9c197 100644
--- a/insights/core/spec_factory.py
+++ b/insights/core/spec_factory.py
@@ -32,7 +32,7 @@ SAFE_ENV = {
         "/usr/sbin",
         "/usr/share/Modules/bin",
     ]),
-    "LC_ALL": "C",
+    "LC_ALL": "C.UTF-8",
 }
 """
 A minimal set of environment variables for use in subprocess calls

Maybe it could be better, and avoid the need to care about specific applications?

@ptoscano
Copy link
Contributor Author

Another possibility here could be the modify SAFE_ENV directly to be unicode, applying the same for every command run:

This was attempted by #3529, which apparently was withdrawn.

@xiangce
Copy link
Contributor

xiangce commented Feb 2, 2023

This was attempted by #3529, which apparently was withdrawn.

Thanks @ptoscano , let's adopt the new resolution of #3636, it's more flexible and won't affect the other commands which are now running well.

@xiangce xiangce merged commit 64182b3 into RedHatInsights:master Feb 2, 2023
xiangce pushed a commit that referenced this pull request Feb 2, 2023
The default environment for "simple_command" includes LC_ALL=C, which
means ASCII (and not unicode); in case the language of the system is set
to a non-English locale that uses unicode characters (e.g. non-Latin1
languages), then subscription-manager will fail to output that with
encoding issues (e.g. [1]).

As a simple solution, enforce an unicode English locale for
subscription-manager, which should avoid those encoding issues.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=2074745

Signed-off-by: Pino Toscano <[email protected]>
(cherry picked from commit 64182b3)
@ptoscano ptoscano deleted the subman-locale branch February 2, 2023 06:32
xiangce pushed a commit that referenced this pull request Sep 6, 2024
The default environment for "simple_command" includes LC_ALL=C, which
means ASCII (and not unicode); in case the language of the system is set
to a non-English locale that uses unicode characters (e.g. non-Latin1
languages), then subscription-manager will fail to output that with
encoding issues (e.g. [1]).

As a simple solution, enforce an unicode English locale for
subscription-manager, which should avoid those encoding issues.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=2074745

Signed-off-by: Pino Toscano <[email protected]>
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