Page MenuHomePhorge

Fix Diffusion commands in non-English environments
ClosedPublic

Authored by valerio.bozzolan on Thu, Dec 5, 15:43.

Details

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.

Diff Detail

Repository
rP Phorge
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

aklapper subscribed.

After installing subversion and setting LC_ALL instead of LANG I can finally reproduce on a Fedora 40 system:

Before:

[acko@fedora phorge (master $|u=)]$ LC_ALL=fr_FR.utf8 ../arcanist/bin/arc unit ./src/applications/repository/worker/__tests__/PhabricatorChangeParserTestCase.php
   FAIL  PhabricatorChangeParserTestCase::testSubversionPartialParser
EXCEPTION (CommandException): Command failed with error #1!
COMMAND
svn --non-interactive log --xml --quiet --limit 4 file:///tmp/pfkja9lhp6o488kw/trunk/@2

STDOUT
<?xml version="1.0" encoding="UTF-8"?>
<log>


STDERR
svn: E160013: Fichier non trouvé : révision 2, chemin '/trunk'

#0 /var/www/html/phorge/arcanist/src/future/exec/ExecFuture.php(341): ExecFuture->raiseResultError(Array)
#1 /var/www/html/phorge/phorge/src/applications/repository/storage/PhabricatorRepository.php(495): ExecFuture->resolvex()
#2 /var/www/html/phorge/phorge/src/applications/repository/engine/PhabricatorRepositoryDiscoveryEngine.php(256): PhabricatorRepository->execxRemoteCommand('...', 4, '...')
#3 /var/www/html/phorge/phorge/src/applications/repository/engine/PhabricatorRepositoryDiscoveryEngine.php(71): PhabricatorRepositoryDiscoveryEngine->discoverSubversionCommits()
#4 /var/www/html/phorge/phorge/src/applications/repository/engine/PhabricatorRepositoryDiscoveryEngine.php(53): PhabricatorRepositoryDiscoveryEngine->discoverCommitsWithLock()
#5 /var/www/html/phorge/phorge/src/applications/repository/worker/__tests__/PhabricatorChangeParserTestCase.php(971): PhabricatorRepositoryDiscoveryEngine->discoverCommits()
#6 /var/www/html/phorge/arcanist/src/unit/engine/phutil/PhutilTestCase.php(639): PhabricatorChangeParserTestCase->testSubversionPartialParser()
#7 /var/www/html/phorge/arcanist/src/unit/engine/PhutilUnitTestEngine.php(69): PhutilTestCase->run()
#8 /var/www/html/phorge/arcanist/src/unit/engine/ArcanistConfigurationDrivenUnitTestEngine.php(148): PhutilUnitTestEngine->run()
#9 /var/www/html/phorge/arcanist/src/workflow/ArcanistUnitWorkflow.php(170): ArcanistConfigurationDrivenUnitTestEngine->run()
#10 /var/www/html/phorge/arcanist/scripts/arcanist.php(427): ArcanistUnitWorkflow->run()
#11 {main}
   SKIP  PhabricatorChangeParserTestCase::testMercurialParser
No binary "hg" found on this system, skipping test.
   PASS  333ms   PhabricatorChangeParserTestCase::testSubversionForeignStubsParser
   PASS  668ms   PhabricatorChangeParserTestCase::testGitParser
   PASS  273ms   PhabricatorChangeParserTestCase::testSubversionValidRootParser
   PASS  941ms   PhabricatorChangeParserTestCase::testSubversionParser

COVERAGE REPORT
     76%     src/applications/repository/worker/__tests__/PhabricatorChangeParserTestCase.php

After:

[acko@fedora phorge (master $|u=)]$ LC_ALL=fr_FR.utf8 ../arcanist/bin/arc unit ./src/applications/repository/worker/__tests__/PhabricatorChangeParserTestCase.php
   PASS  828ms   PhabricatorChangeParserTestCase::testGitParser
   PASS  281ms   PhabricatorChangeParserTestCase::testSubversionValidRootParser
   PASS  929ms   PhabricatorChangeParserTestCase::testSubversionParser
   PASS  326ms   PhabricatorChangeParserTestCase::testSubversionForeignStubsParser
   SKIP  PhabricatorChangeParserTestCase::testMercurialParser
No binary "hg" found on this system, skipping test.
   PASS  260ms   PhabricatorChangeParserTestCase::testSubversionPartialParser

COVERAGE REPORT
     83%     src/applications/repository/worker/__tests__/PhabricatorChangeParserTestCase.php
This revision is now accepted and ready to land.Tue, Dec 10, 09:52