From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 6F21C1F4CA for ; Mon, 11 Nov 2024 21:56:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1731362217; bh=UTO0+INqnvLiCG5hLr9SLg8BKYvJT7ngz1wJtPaXvRQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Ier7elyBPzkzcuZh579v4kB0K0rgPRz3qvVd6Em2uaQ6j6Et7agINvc0I6KiU0p2i 833cnVEedwOqhfr6ElIbY1AmDBcdHpKy2PO7mS5fZmKAg2kYN42BG+ObeMRgpzz8C0 XMXyKQcbSLJ05HbS5a9LdH2Y0iB1Nrsrzv7aQNnM= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 3/4] import: avoid uninitialized comparison on failures Date: Mon, 11 Nov 2024 21:56:55 +0000 Message-ID: <20241111215656.2411957-4-e@80x24.org> In-Reply-To: <20241111215656.2411957-1-e@80x24.org> References: <20241111215656.2411957-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/Import.pm b/lib/PublicInbox/Import.pm index 2e193d46..ae46c5f4 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; }