Skip to content

Commit

Permalink
fix: Run subshells with LC_ALL=C.UTF-8
Browse files Browse the repository at this point in the history
* Card ID: RHINENG-11802
* Card ID: CCT-653

Ensure we get Unicode data back when we run GPG in a subshell. This will
ensure we are able to parse output of the command even if the host is
configured to use non-UTF-8 character set.
  • Loading branch information
m-horky authored and ptoscano committed Aug 14, 2024
1 parent f9e14c2 commit e6755d9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/insights_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ def _remove_gpg_home(home):
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
universal_newlines=True,
env={"LC_ALL": "C.UTF-8"},
)
stdout, stderr = shutdown_process.communicate()
if shutdown_process.returncode != 0:
Expand Down Expand Up @@ -218,6 +219,7 @@ def gpg_validate(path):
import_command,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
env={"LC_ALL": "C.UTF-8"},
)
import_process.communicate()
if import_process.returncode != 0:
Expand All @@ -239,7 +241,10 @@ def gpg_validate(path):
]
logger.debug("Running command: %s", debug_command(verify_command))
verify_process = subprocess.Popen(
verify_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE
verify_command,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
env={"LC_ALL": "C.UTF-8"},
)
verify_process.communicate()
_remove_gpg_home(home)
Expand Down

0 comments on commit e6755d9

Please sign in to comment.