From 14fcf61a1eee8ca70f58528b03aeb10958599f9e Mon Sep 17 00:00:00 2001 From: Valerio Bozzolan Date: Wed, 11 Dec 2024 08:32:54 +0100 Subject: [PATCH] Fix Diffusion commands in non-English environments Summary: Closes T15966 Force Diffusion commands to be executed in the "LC_ALL=C" language mode, that is, English, defusing whatever custom language you have in your LANGUAGE variable. Related reading: https://we.phorge.it/T15872 Test Plan: Make sure Subversion is installed on your system. Explicitly set `LC_ALL`. Finally, this unit test works, even if you have something esoteric in your LANGUAGE: arc unit ./src/applications/repository/worker/__tests__/PhabricatorChangeParserTestCase.php Before, it was crashing, like mentioned in T15966. Reviewers: O1 Blessed Committers, aklapper Reviewed By: O1 Blessed Committers, aklapper Subscribers: aklapper, tobiaswiese, Matthew, Cigaryno Maniphest Tasks: T15966 Differential Revision: https://we.phorge.it/D25846 --- .../diffusion/protocol/DiffusionCommandEngine.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/applications/diffusion/protocol/DiffusionCommandEngine.php b/src/applications/diffusion/protocol/DiffusionCommandEngine.php index db9d930151..0a31183c82 100644 --- a/src/applications/diffusion/protocol/DiffusionCommandEngine.php +++ b/src/applications/diffusion/protocol/DiffusionCommandEngine.php @@ -175,10 +175,12 @@ abstract class DiffusionCommandEngine extends Phobject { $repository = $this->getRepository(); $env = array(); - // NOTE: Force the language to "en_US.UTF-8", which overrides locale + // NOTE: Force the language to "C", which overrides locale // settings. This makes stuff print in English instead of, e.g., French, // so we can parse the output of some commands, error messages, etc. - $env['LANG'] = 'en_US.UTF-8'; + // Note that LANG can be ignored if there is LANGUAGE. + // https://we.phorge.it/T15872 + $env['LC_ALL'] = 'C'; // Propagate PHABRICATOR_ENV explicitly. For discussion, see T4155. $env['PHABRICATOR_ENV'] = PhabricatorEnv::getSelectedEnvironmentName();