From b4920c83adf959c5bd1b6b9157ce67a858c9d4db Mon Sep 17 00:00:00 2001 From: Michael Pardatscher Date: Wed, 25 Oct 2023 15:47:55 +0200 Subject: [PATCH] Fix locale related parsing error in git.py * Fix locale related parsing error in git.py This fixes the issue found at https://github.com/ansible/ansible/issues/77213 which got introduced by changing over to "best parseable locale" approach, but missing out the requirement of locales other than `L` having to have `LANGUAGE` specified as well. For further details, check this post within the issue discussion: https://github.com/ansible/ansible/issues/77213#issuecomment-1446919617 * Add changelog Create 81931-locale-related-parsing-error-git.yml --- .../fragments/81931-locale-related-parsing-error-git.yml | 3 +++ lib/ansible/modules/git.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/81931-locale-related-parsing-error-git.yml diff --git a/changelogs/fragments/81931-locale-related-parsing-error-git.yml b/changelogs/fragments/81931-locale-related-parsing-error-git.yml new file mode 100644 index 00000000000..8ec3e9c5082 --- /dev/null +++ b/changelogs/fragments/81931-locale-related-parsing-error-git.yml @@ -0,0 +1,3 @@ +--- +bugfixes: + - Fix setting proper locale for git executable when running on non english systems, ensuring git output can always be parsed. diff --git a/lib/ansible/modules/git.py b/lib/ansible/modules/git.py index f40e43f30a5..5460a24a269 100644 --- a/lib/ansible/modules/git.py +++ b/lib/ansible/modules/git.py @@ -1263,7 +1263,7 @@ def main(): # We screenscrape a huge amount of git commands so use C locale anytime we # call run_command() locale = get_best_parsable_locale(module) - module.run_command_environ_update = dict(LANG=locale, LC_ALL=locale, LC_MESSAGES=locale, LC_CTYPE=locale) + module.run_command_environ_update = dict(LANG=locale, LC_ALL=locale, LC_MESSAGES=locale, LC_CTYPE=locale, LANGUAGE=locale) if separate_git_dir: separate_git_dir = os.path.realpath(separate_git_dir)