From f7f6dc340ed4eb2bddc41993e112f8f18fcc1598 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Sun, 16 Jul 2017 06:45:32 -0400 Subject: t: handle EOF in test_copy_bytes() The test_copy_bytes() function claims to read up to N bytes, or until it gets EOF. But we never handle EOF in our loop, and a short input will cause perl to go into an infinite loop of read() getting zero bytes. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- t/test-lib-functions.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh index db622c3555..50a9a1d1c4 100644 --- a/t/test-lib-functions.sh +++ b/t/test-lib-functions.sh @@ -999,6 +999,7 @@ test_copy_bytes () { my $s; my $nread = sysread(STDIN, $s, $len); die "cannot read: $!" unless defined($nread); + last unless $nread; print $s; $len -= $nread; } -- cgit v1.2.1