From 72e59da8047c8e0d048aff3bdbddbfb7e11e4e99 Mon Sep 17 00:00:00 2001 From: Valerio Bozzolan Date: Mon, 8 Jul 2024 10:03:25 +0200 Subject: [PATCH] Fix arc diff in Subversion for non-English languages Summary: When using `arc diff`, this crash should not fire anymore on non-English shells: Undefined array key "Repository UUID" The error message comes to this line: https://we.phorge.it/source/arcanist/browse/master/src/repository/api/ArcanistSubversionAPI.php;f7fcf31c7e23475e345cb3cd4abf0474ba6fd9cf$606 Look at the parser of `svn info` that expects English language: https://we.phorge.it/source/arcanist/browse/master/src/repository/api/ArcanistSubversionAPI.php;f7fcf31c7e23475e345cb3cd4abf0474ba6fd9cf$326-375 The historical behavior of `ExecFuture` is to inherit environment variables. It may have sense, to have the user home, etc. So, the approach is to just clear the incompatible specific environment variable that alters the output language. Closes T15855 Test Plan: - clone a random a Subversion repository - have your operating system in a non-English language - (e.g. `export LANGUAGE=en_US:it_IT`) - run 'arc diff' No crash anymore. You are able to submit the patch, just like in git. Reviewers: O1 Blessed Committers, l2dy, avivey Reviewed By: O1 Blessed Committers, l2dy, avivey Subscribers: l2dy, aklapper, tobiaswiese, Matthew, Cigaryno Maniphest Tasks: T15855 Differential Revision: https://we.phorge.it/D25691 --- src/repository/api/ArcanistSubversionAPI.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/repository/api/ArcanistSubversionAPI.php b/src/repository/api/ArcanistSubversionAPI.php index cfd4ab30..6fc17bf5 100644 --- a/src/repository/api/ArcanistSubversionAPI.php +++ b/src/repository/api/ArcanistSubversionAPI.php @@ -40,6 +40,12 @@ final class ArcanistSubversionAPI extends ArcanistRepositoryAPI { $argv[0] = 'svn '.$argv[0]; $future = newv('ExecFuture', $argv); + + // For historical reasons we run Subversion commands keeping env. + // But, let's keep English, to have a reliable parser. + // https://we.phorge.it/T15872 + $future->updateEnv('LC_ALL', 'C'); + $future->setCWD($this->getPath()); return $future; }