From 6419423cde036b53c45bf56c10a8341601ab097c Mon Sep 17 00:00:00 2001 From: Kai Franz Date: Fri, 8 Mar 2024 16:53:16 -0800 Subject: [PATCH] [#21381] Tools: Set LC_ALL=C.UTF-8 when running pgrep in yb-ctl Summary: When other processes have UTF-8 characters in their names, pgrep may fail due to expecting a different encoding. This revision fixes the issue by setting the `LC_ALL` environment variable to `C.UTF-8` when invoking `pgrep`. Note that the environment variable is only set for the subprocess which `pgrep` runs in; this change does not modify it anywhere else. Jira: DB-10275 Test Plan: ``` bin/yb-ctl create ``` Reviewers: mbautin Reviewed By: mbautin Differential Revision: https://phorge.dev.yugabyte.com/D33008 --- scripts/installation/bin/yb-ctl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/installation/bin/yb-ctl b/scripts/installation/bin/yb-ctl index 267bff957a4b..392e5aae1313 100755 --- a/scripts/installation/bin/yb-ctl +++ b/scripts/installation/bin/yb-ctl @@ -1284,7 +1284,8 @@ class ClusterControl: pgrep_full_command_output_arg = '--list-full' pgrep_regex_str = self.get_pgrep_regex(daemon_id) pgrep_output = subprocess.check_output( - ["pgrep", pgrep_full_command_output_arg, "-f", pgrep_regex_str] + ["pgrep", pgrep_full_command_output_arg, "-f", pgrep_regex_str], + env={"LC_ALL": "C.UTF-8"} ).strip().decode('utf-8') data_dirs_re_match = FS_DATA_DIRS_ARG_RE.search(pgrep_output)