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, T_SCC_BODY_TEXT_LINE 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 65BF21F452 for ; Mon, 13 Nov 2023 13:15:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1699881352; bh=OkmhkMx7M8AWYxkTo/iX9IeFtrXRdnkrkTNqSLJKu3Q=; h=From:To:Subject:Date:In-Reply-To:References:From; b=DAaXlB2cAqj89iSFYV980Rv2gq7WGFiBQnUtOGkWUfKh8uceAHja9okUaj9hHUFJA sei3/IqkDRTtCe0UnGzK4VOiBx4XjK8nlQBk+l0j3iX+XANRAxbqAAiHIKqH8xfZ1J jakCgGE0nK1IGD13TCB1eAUgOh27OiBFXBoFXB2g= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 01/18] cindex: check `say' errors w/ close or ->flush Date: Mon, 13 Nov 2023 13:15:34 +0000 Message-Id: <20231113131551.843230-2-e@80x24.org> In-Reply-To: <20231113131551.843230-1-e@80x24.org> References: <20231113131551.843230-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: We actually need to rely on autodie `close' to check for errors, since error-checking with `say' is not useful due to perlio write buffering. We'll also stop relying on `say ... or die' since it's needless noise. Fixes: 19f9089343c9 (cindex: drop redundant close on regular FH) --- lib/PublicInbox/CodeSearchIdx.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/PublicInbox/CodeSearchIdx.pm b/lib/PublicInbox/CodeSearchIdx.pm index 0b00c303..5b80db44 100644 --- a/lib/PublicInbox/CodeSearchIdx.pm +++ b/lib/PublicInbox/CodeSearchIdx.pm @@ -468,12 +468,12 @@ sub partition_refs ($$$) { chomp $cmt; my $n = hex(substr($cmt, 0, 8)) % scalar(@RDONLY_XDB); if ($REINDEX && $REINDEX->set_maybe(pack('H*', $cmt), '')) { - say { $shard_in[$n] } $cmt or die "say: $!"; + say { $shard_in[$n] } $cmt; ++$NCHANGE; } elsif (seen($RDONLY_XDB[$n], 'Q'.$cmt)) { last if ++$seen > $SEEN_MAX; } else { - say { $shard_in[$n] } $cmt or die "say: $!"; + say { $shard_in[$n] } $cmt; ++$NCHANGE; $seen = 0; } @@ -845,7 +845,7 @@ EOM PublicInbox::Import::init_bare($git_dir, 'cidx-all', $fmt); open $ALT_FH{$hexlen}, '>', "$git_dir/objects/info/alternates"; } - say { $ALT_FH{$hexlen} } $objdir or die "say: $!"; + say { $ALT_FH{$hexlen} } $objdir; } sub prep_alternate_start { @@ -969,7 +969,7 @@ sub dump_git_commits { # run_await cb (defined($pid) && $?) and die "E: @PRUNE_BATCH: \$?=$?"; return if $DO_QUIT; my ($hexlen) = keys(%ALT_FH) or return; # done - delete $ALT_FH{$hexlen}; + close(delete $ALT_FH{$hexlen}); # flushes `say' buffer $PRUNE_BATCH[1] = "--git-dir=$TMPDIR/hexlen$hexlen.git"; run_await(\@PRUNE_BATCH, undef, $batch_opt, \&dump_git_commits);