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 045241FA62 for ; Wed, 25 Oct 2023 00:29:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1698193794; bh=BRR4MsgWlJmX3vCPELiZyVGpKyFBnBbRotvFlSmn7cU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ufzL75mRXl0BOruCANw+x1H4xAaPD0l4qw8VJOemYEBaW7swNsKFu+84J/CoRACgm if4EP94lPFs85nbu4B0wzbniMdbwvabxJz+NwywYKmdE4YWRSH97s0GdgT9SR3ywQX R33+5didwYwfW9EKJdrJoFtGzewbmgmSClHU8gJY= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 26/26] cindex: use sysread for generating fingerprint Date: Wed, 25 Oct 2023 00:29:49 +0000 Message-ID: <20231025002949.3092193-27-e@80x24.org> In-Reply-To: <20231025002949.3092193-1-e@80x24.org> References: <20231025002949.3092193-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: We use sysseek for this file handle elsewhere (since it's passed to `git rev-list --stdin' multiple times), and sysread ensures we can use a larger read buffer than the tiny 8K BUFSIZ Perl + glibc is contrained to. This also ensures we autodie on sysread failures, since the autodie import for `read' was missing and we don't call `read' anywhere else in this file. --- lib/PublicInbox/CodeSearchIdx.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/PublicInbox/CodeSearchIdx.pm b/lib/PublicInbox/CodeSearchIdx.pm index e17cba39..e31432b9 100644 --- a/lib/PublicInbox/CodeSearchIdx.pm +++ b/lib/PublicInbox/CodeSearchIdx.pm @@ -57,7 +57,7 @@ use PublicInbox::Git qw(%OFMT2HEXLEN); use PublicInbox::Compat qw(uniqstr); use PublicInbox::Aspawn qw(run_await); use Carp (); -use autodie qw(pipe open seek sysseek send); +use autodie qw(pipe open sysread seek sysseek send); our $DO_QUIT = 15; # signal number our ( $LIVE_JOBS, # integer @@ -385,10 +385,10 @@ sub fp_start ($$$) { sub fp_fini { # run_git cb my (undef, $self, $git, $prep_repo) = @_; my $refs = $git->{-repo}->{refs} // die 'BUG: no {-repo}->{refs}'; - seek($refs, 0, SEEK_SET); + sysseek($refs, 0, SEEK_SET); my $buf; my $dig = PublicInbox::SHA->new(256); - while (read($refs, $buf, 65536)) { $dig->add($buf) } + while (sysread($refs, $buf, 65536)) { $dig->add($buf) } $git->{-repo}->{fp} = $dig->hexdigest; }