1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-13 00:56:15 +01:00

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
This commit is contained in:
Valerio Bozzolan 2024-12-11 08:32:54 +01:00
parent c4f88847ef
commit 14fcf61a1e

View file

@ -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();