From 959a835b95dd39bb2463882ce989e2d5e7401b8e Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 22 May 2020 05:42:34 -0700 Subject: [PATCH] When executing a repository passthru command via CommandEngine, don't set a timeout Summary: Ref T13541. The passthru future does not have time limit behavior, so if we reach this code we currently fail. Phabricator never reaches this code normally, but this code is reachable during debugging if you try to foreground a slow fetch to inspect it. Passthru commands generally only make sense to run interactively, and the caller or control script can enforce their own timeouts (usually by pressing "^C" with their fingers). Test Plan: Used a debugging script to run ref-by-ref fetches in the foreground. Maniphest Tasks: T13541 Differential Revision: https://secure.phabricator.com/D21284 --- .../diffusion/protocol/DiffusionCommandEngine.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/applications/diffusion/protocol/DiffusionCommandEngine.php b/src/applications/diffusion/protocol/DiffusionCommandEngine.php index a0fe568168..a0f1adaf1f 100644 --- a/src/applications/diffusion/protocol/DiffusionCommandEngine.php +++ b/src/applications/diffusion/protocol/DiffusionCommandEngine.php @@ -120,6 +120,7 @@ abstract class DiffusionCommandEngine extends Phobject { public function newFuture() { $argv = $this->newCommandArgv(); $env = $this->newCommandEnvironment(); + $is_passthru = $this->getPassthru(); if ($this->getSudoAsDaemon()) { $command = call_user_func_array('csprintf', $argv); @@ -127,7 +128,7 @@ abstract class DiffusionCommandEngine extends Phobject { $argv = array('%C', $command); } - if ($this->getPassthru()) { + if ($is_passthru) { $future = newv('PhutilExecPassthru', $argv); } else { $future = newv('ExecFuture', $argv); @@ -139,7 +140,9 @@ abstract class DiffusionCommandEngine extends Phobject { // to try to avoid cases where `git fetch` hangs for some reason and we're // left sitting with a held lock forever. $repository = $this->getRepository(); - $future->setTimeout($repository->getEffectiveCopyTimeLimit()); + if (!$is_passthru) { + $future->setTimeout($repository->getEffectiveCopyTimeLimit()); + } return $future; }