When comm(1) has a lot of data to output, we must ensure we
explicitly close FDs of processes in previous stages of the
pipeline to ensure comm(1) to terminates properly.

This is difficult to test automatically with small test repos...

Fixes: 17b06aa32aac (cindex: start using run_await to simplify code)
---
 lib/PublicInbox/CodeSearchIdx.pm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/PublicInbox/CodeSearchIdx.pm b/lib/PublicInbox/CodeSearchIdx.pm
index 80636270..33080664 100644
--- a/lib/PublicInbox/CodeSearchIdx.pm
+++ b/lib/PublicInbox/CodeSearchIdx.pm
@@ -993,6 +993,7 @@ sub run_prune { # OnDestroy when `git config 
extensions.objectFormat' are done
        run_await(\@AWK, $CMD_ENV, $awk_opt, \&cmd_done);
        run_await([@SORT, '-u'], $CMD_ENV, $sort_opt, \&cmd_done);
        my $comm_rd = popen_rd(\@COMM, $CMD_ENV, $comm_opt, \&cmd_done, \@COMM);
+       %$_ = () for ($awk_opt, $sort_opt, $comm_opt); # comm_rd is blocking :<
        PublicInbox::CidxComm->new($comm_rd, $self); # calls cidx_read_comm
        my $git_ver = PublicInbox::Git::git_version();
        push @PRUNE_BATCH, '--buffer' if $git_ver ge v2.6;

Reply via email to