From: Eric Wong Date: Mon, 11 Nov 2024 21:56:55 +0000 (+0000) Subject: import: avoid uninitialized comparison on failures X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1a94d522650d1cdcace0e624f351a29f5cf338be;p=thirdparty%2Fpublic-inbox.git import: avoid uninitialized comparison on failures 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... --- diff --git a/lib/PublicInbox/Import.pm b/lib/PublicInbox/Import.pm index 2e193d464..ae46c5f40 100644 --- a/lib/PublicInbox/Import.pm +++ b/lib/PublicInbox/Import.pm @@ -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; }