From 0375758806f3dbd6a4e62cb367c20453a779272d Mon Sep 17 00:00:00 2001 From: Elijah Newren Date: Sat, 16 May 2020 12:23:09 -0700 Subject: [PATCH] filter-repo: fix possible deadlock in sanity_check_args MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I'm a little surprised that stdout buffers must have filled up on MacOS X, but either way we don't have to wait for the '-h' processes to finish before attempting to read stdout. In fact, since we weren't storing the returncode attribute from calling p.wait(), there wasn't much point in doing so. Trying to read all stdout all at once is going to implicitly take until the process finishes anyway, so just do that. Reported-by: Benoit Lefèvre Signed-off-by: Elijah Newren --- git-filter-repo | 2 -- 1 file changed, 2 deletions(-) diff --git a/git-filter-repo b/git-filter-repo index ffc6fa9..0594140 100755 --- a/git-filter-repo +++ b/git-filter-repo @@ -2039,7 +2039,6 @@ EXAMPLES # PERF: remove these checks once new enough git versions are common p = subproc.Popen('git fast-export -h'.split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - p.wait() output = p.stdout.read() if b'--mark-tags' not in output: # pragma: no cover global write_marks @@ -2060,7 +2059,6 @@ EXAMPLES # diff-tree --combined-all-paths, which is even more important... p = subproc.Popen('git diff-tree -h'.split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - p.wait() output = p.stdout.read() if b'--combined-all-paths' not in output: # We need a version of git-diff-tree with --combined-all-paths