]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
import: avoid uninitialized comparison on failures
authorEric Wong <e@80x24.org>
Mon, 11 Nov 2024 21:56:55 +0000 (21:56 +0000)
committerEric Wong <e@80x24.org>
Tue, 12 Nov 2024 20:13:17 +0000 (20:13 +0000)
readline may return undef when fast-import fails (as triggered
by t/lei-store-fail.t).  Ensure we give a more informative error
message in the syslog when this happens.  Arguably, having this
in the syslog when a client is connected via terminal is probably
not great, but perhaps unavoidable...

lib/PublicInbox/Import.pm

index 2e193d46479f5b76509c3a2c8da0ab8bf430c21a..ae46c5f400ac9ffb4e07c4579837980b1991d1f6 100644 (file)
@@ -152,8 +152,8 @@ sub progress {
        my ($self, $msg) = @_;
        my $io = $self->{io} or return;
        print $io "progress $msg\n" or wfail;
-       readline($io) eq "progress $msg\n" or die
-               "progress $msg not received\n";
+       my $res = <$io> // die "EOF from fast-import progress $msg: $!";
+       $res eq "progress $msg\n" or die "BUG: `$res' != `progress $msg'";
        undef;
 }