From: Phillip Wood Date: Fri, 21 Jun 2024 13:03:14 GMT Subject: Re: [PATCH 2/2] t9700: ensure cat-file info isn't buffered by default Message-ID: In-Reply-To: <20240619180807.M97115@dcvr> On 19/06/2024 19:08, Eric Wong wrote: > Phillip Wood wrote: >> Hi Eric >> >> On 17/06/2024 11:43, Eric Wong wrote: >>> +# ensure --batch-check is unbuffered by default >>> +my ($pid, $in, $out, $ctx) = $r->command_bidi_pipe(qw(cat-file --batch-check)); >>> +print $out $file1hash, "\n" or die $!; >> >> It's been a while since I did any perl scripting and I'm not clear whether >> $out is buffered or not and if it is whether it is guaranteed to be flushed >> when we print "\n". It might be worth adding a explicit flush so it is clear >> that any deadlocks come from cat-file and not our test code. > > Pipes and sockets created by Perl are always unbuffered since > 5.8, at least. If they were buffered, Git.pm users (including > git-svn) wouldn't have worked at all. Thanks for clarifying that >>> +my $info = <$in>; >> >> Is there an easy way to add a timeout to this read so that the failure mode >> isn't "the test hangs without printing anything"? I'm not sure that failure >> mode is easy to diagnose from our CI output as it is hard to tell which test >> caused the CI to timeout and it takes ages for the CI to time out. > > Yeah, select() has been added in v2. That's much nicer. Thanks Phillip